-
-
Notifications
You must be signed in to change notification settings - Fork 5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(webpack): allow function entries for build.transpile
#6120
Conversation
build.transpile
This is a feat/fix by next release. Nothing will be breaking. Some other enhancements we could do is adding an option like |
Codecov Report
@@ Coverage Diff @@
## dev #6120 +/- ##
==========================================
+ Coverage 95.75% 95.75% +<.01%
==========================================
Files 80 80
Lines 2659 2665 +6
Branches 682 686 +4
==========================================
+ Hits 2546 2552 +6
Misses 97 97
Partials 16 16
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If function is one of array items, then it can only return string or regex pattern.
Do you think is there any use case for multiple functions, maybe modules ?
How about just making transpile
as function, like:
transpile: () => {
return [
'vue-test',
'@vue/test'
]
}
packages/webpack/src/config/base.js
Outdated
if (pattern instanceof RegExp) { | ||
items.push(pattern) | ||
} else { | ||
} else if (pattern) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be string ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, Will update to check typeof pattern === 'string'
@clarkdo Making |
Ready to review |
@@ -20,10 +20,13 @@ export default class WebpackServerConfig extends WebpackBaseConfig { | |||
const whitelist = [ | |||
/\.(?!js(x|on)?$)/i | |||
] | |||
for (const pattern of this.buildContext.buildOptions.transpile) { | |||
for (let pattern of this.buildContext.buildOptions.transpile) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like we have a duplicate code block here (as in src/config/base.js
, L61-70). Could we extract it somehow?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will do it in another pr since this has been a long time
Types of changes
Description
It's mostly a feature for module, thinking of
@nuxt/http
for example that need to addky
inbuild.transpile
but only for legacy mode.Before:
After:
The main issue I see is that module author will have to check Nuxt version to be able to push a function in
build.transpile
otherwise it justs breaks 😢Checklist: