Skip to content
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

[v3.0] Run output plugins last #3846

Merged
merged 2 commits into from Jul 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/utils/PluginDriver.ts
Expand Up @@ -105,7 +105,7 @@ export class PluginDriver {
this.finaliseAssets = this.fileEmitter.finaliseAssets.bind(this.fileEmitter);
this.setChunkInformation = this.fileEmitter.setChunkInformation.bind(this.fileEmitter);
this.setOutputBundle = this.fileEmitter.setOutputBundle.bind(this.fileEmitter);
this.plugins = userPlugins.concat(basePluginDriver ? basePluginDriver.plugins : []);
this.plugins = (basePluginDriver ? basePluginDriver.plugins : []).concat(userPlugins);
const existingPluginNames = new Set<string>();

this.pluginContexts = new Map(
Expand Down
23 changes: 23 additions & 0 deletions test/form/samples/runs-output-plugins-last/_config.js
@@ -0,0 +1,23 @@
module.exports = {
description: 'runs output plugins last',
options: {
plugins: [
{
name: 'input',
renderChunk(code) {
return `/* input */\n${code}\n/* input */`;
}
}
],
output: {
plugins: [
{
name: 'output',
renderChunk(code) {
return `/* output */\n${code}\n/* output */`;
}
}
]
}
}
};
7 changes: 7 additions & 0 deletions test/form/samples/runs-output-plugins-last/_expected.js
@@ -0,0 +1,7 @@
/* output */
/* input */
let foo = 'base';

export { foo };
/* input */
/* output */
1 change: 1 addition & 0 deletions test/form/samples/runs-output-plugins-last/main.js
@@ -0,0 +1 @@
export let foo = 'base';
4 changes: 2 additions & 2 deletions test/function/samples/options-in-renderstart/_config.js
Expand Up @@ -22,10 +22,10 @@ module.exports = {
},
exports: () => {
assert.deepStrictEqual(checkedOptions, [
'output-plugin',
'input-plugin',
'cjs',
'global',
'input-plugin',
'output-plugin',
'cjs',
'global'
]);
Expand Down