Skip to content

Commit

Permalink
fix(webpack): use webpack-merge v4 to support merge.smart and node 10
Browse files Browse the repository at this point in the history
  • Loading branch information
erezrokah committed Jul 19, 2020
1 parent e220ca4 commit e5e425d
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 30 deletions.
24 changes: 24 additions & 0 deletions lib/build.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,29 @@ describe('build', () => {
}),
).rejects.toThrow('Cannot find module');
});

it('should merge webpack custom config', async () => {
const script = `module.exports = () => console.log("hello world")`;
setupFunction(script, 'index.js');

const webpackConfig = `module.exports = { resolve: { extensions: ['.custom'] } }`;
const customWebpackConfigDir = path.join(buildTemp, 'webpack');
const userWebpackConfig = path.join(customWebpackConfigDir, 'webpack.js');
fs.mkdirSync(customWebpackConfigDir, { recursive: true });
fs.writeFileSync(userWebpackConfig, webpackConfig);

const stats = await build.run(functions, {
userWebpackConfig,
});
expect(stats.compilation.errors).toHaveLength(0);
expect(stats.compilation.options.resolve.extensions).toEqual([
'.wasm',
'.mjs',
'.js',
'.json',
'.ts',
'.custom',
]);
});
});
});
59 changes: 30 additions & 29 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"jwt-decode": "^2.2.0",
"toml": "^3.0.0",
"webpack": "^4.43.0",
"webpack-merge": "^5.0.9"
"webpack-merge": "^4.2.2"
},
"devDependencies": {
"@commitlint/cli": "^9.0.0",
Expand Down

0 comments on commit e5e425d

Please sign in to comment.