diff --git a/tests/fixtures.ts b/tests/fixtures.ts index 4414a80..879022c 100644 --- a/tests/fixtures.ts +++ b/tests/fixtures.ts @@ -162,6 +162,10 @@ export const minification = { '/src/index.js': 'export default ( stringVal ) => { return stringVal }', }; +export const define = { + '/src/index.js': 'export default () => [__TEST1__, __TEST2__]', +}; + export const getHelpers = { '/src/index.js': 'export default async () => {}', }; diff --git a/tests/specs/plugin.ts b/tests/specs/plugin.ts index f1ee00e..cf074d8 100644 --- a/tests/specs/plugin.ts +++ b/tests/specs/plugin.ts @@ -750,5 +750,33 @@ export default testSuite(({ describe }, webpack: typeof webpack4 | typeof webpac webpack, )).resolves.toBeTruthy(); }); + + test('multiple plugins', async () => { + const built = await build( + fixtures.define, + (config) => { + configureEsbuildMinifyPlugin(config); + config.plugins?.push( + new EsbuildPlugin({ + define: { + __TEST1__: '123', + }, + }), + new EsbuildPlugin({ + define: { + __TEST2__: '321', + }, + }), + ); + }, + webpack, + ); + + expect(built.stats.hasWarnings()).toBe(false); + expect(built.stats.hasErrors()).toBe(false); + + const exportedFunction = built.require('/dist/'); + expect(exportedFunction('hello world')).toStrictEqual([123, 321]); + }); }); });