Skip to content

Commit f1cabaa

Browse files
authored
fix(webpack): use webpack-merge v4 to support merge.smart (#252)
1 parent e220ca4 commit f1cabaa

File tree

3 files changed

+55
-30
lines changed

3 files changed

+55
-30
lines changed

lib/build.spec.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,5 +65,29 @@ describe('build', () => {
6565
}),
6666
).rejects.toThrow('Cannot find module');
6767
});
68+
69+
it('should merge webpack custom config', async () => {
70+
const script = `module.exports = () => console.log("hello world")`;
71+
setupFunction(script, 'index.js');
72+
73+
const webpackConfig = `module.exports = { resolve: { extensions: ['.custom'] } }`;
74+
const customWebpackConfigDir = path.join(buildTemp, 'webpack');
75+
const userWebpackConfig = path.join(customWebpackConfigDir, 'webpack.js');
76+
fs.mkdirSync(customWebpackConfigDir, { recursive: true });
77+
fs.writeFileSync(userWebpackConfig, webpackConfig);
78+
79+
const stats = await build.run(functions, {
80+
userWebpackConfig,
81+
});
82+
expect(stats.compilation.errors).toHaveLength(0);
83+
expect(stats.compilation.options.resolve.extensions).toEqual([
84+
'.wasm',
85+
'.mjs',
86+
'.js',
87+
'.json',
88+
'.ts',
89+
'.custom',
90+
]);
91+
});
6892
});
6993
});

package-lock.json

Lines changed: 30 additions & 29 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"jwt-decode": "^2.2.0",
4545
"toml": "^3.0.0",
4646
"webpack": "^4.43.0",
47-
"webpack-merge": "^5.0.9"
47+
"webpack-merge": "^4.2.2"
4848
},
4949
"devDependencies": {
5050
"@commitlint/cli": "^9.0.0",

0 commit comments

Comments
 (0)