-
-
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
fix: Duplicate declaration plugin when add/remove file in dev mode #4278
Conversation
Codecov Report
@@ Coverage Diff @@
## dev #4278 +/- ##
==========================================
+ Coverage 92.28% 92.29% +<.01%
==========================================
Files 52 52
Lines 1712 1713 +1
Branches 447 447
==========================================
+ Hits 1580 1581 +1
Misses 126 126
Partials 6 6
Continue to review full report at Codecov.
|
@@ -207,6 +207,7 @@ export default class Builder { | |||
async generateRoutesAndFiles() { | |||
consola.debug(`Generating nuxt files`) | |||
|
|||
this.plugins.length = 0 | |||
this.plugins.push.apply(this.plugins, this.normalizePlugins()) |
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.
Can't we still simply set a new array to this.plugins?
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.
This wouldn't clear all references of this.plugins
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.
BuildContext
is using it for registering alias in webpack builder.
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 have an idea, will open a pr.
@pi0 How do you think:
get plugins() {
return this._plugins
}
set plugins(plugins) {
this._plugins = plugins
if (this.bundleBuilder) {
this.bundleBuilder.context.plugins = plugins
}
}
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 love the getter idea. But suggest moving getters into BuildContext class. An smart context with always updated computed props. Allows us changing it's logic anytime without adding complexities to neither Builder or Wevpack
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Types of changes
Description
Probably resolve #4275
Checklist: