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

fix(webpack.config.template.js): webpack resolving child node_modules #970

Merged
merged 1 commit into from
Nov 19, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions lib/resources/content/webpack.config.template.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,20 @@ const cssRules = [
// @if cssProcessor.id='postcss'
{
loader: 'postcss-loader',
options: { plugins: () => [require('autoprefixer')({ browsers: ['last 2 versions'] })]}
options: { plugins: () => [require('autoprefixer')({ browsers: ['last 2 versions'] })] }
}
// @endif
];

module.exports = ({production, server, extractCss, coverage, analyze, karma} = {}) => ({
module.exports = ({ production, server, extractCss, coverage, analyze, karma } = {}) => ({
resolve: {
// @if transpiler.id='typescript'
extensions: ['.ts', '.js'],
// @endif
// @if transpiler.id='babel'
extensions: ['.js'],
// @endif
modules: [srcDir, 'node_modules'],
modules: [srcDir, nodeModulesDir],
// Enforce single aurelia-binding, to avoid v1/v2 duplication due to
// out-of-date dependencies on 3rd party aurelia plugins
alias: { 'aurelia-binding': path.resolve(__dirname, 'node_modules/aurelia-binding') }
Expand All @@ -57,7 +57,7 @@ module.exports = ({production, server, extractCss, coverage, analyze, karma} = {
optimization: {
// Use splitChunks to breakdown the vendor bundle into smaller files
// https://webpack.js.org/plugins/split-chunks-plugin/
splitChunks: {
splitChunks: {
chunks: "initial",
cacheGroups: {
default: false, // Disable the built-in groups (default and vendors)
Expand Down Expand Up @@ -121,8 +121,8 @@ module.exports = ({production, server, extractCss, coverage, analyze, karma} = {
test: /\.css$/i,
issuer: [{ not: [{ test: /\.html$/i }] }],
use: extractCss ? [{
loader: MiniCssExtractPlugin.loader
},
loader: MiniCssExtractPlugin.loader
},
'css-loader'
] : ['style-loader', ...cssRules]
},
Expand Down Expand Up @@ -171,8 +171,9 @@ module.exports = ({production, server, extractCss, coverage, analyze, karma} = {
// @endif
{ test: /\.html$/i, loader: 'html-loader' },
// @if transpiler.id='babel'
{ test: /\.js$/i, loader: 'babel-loader', exclude: nodeModulesDir,
options: coverage ? { sourceMap: 'inline', plugins: [ 'istanbul' ] } : {},
{
test: /\.js$/i, loader: 'babel-loader', exclude: nodeModulesDir,
options: coverage ? { sourceMap: 'inline', plugins: ['istanbul'] } : {},
},
// @endif
// @if transpiler.id='typescript'
Expand Down Expand Up @@ -202,7 +203,7 @@ module.exports = ({production, server, extractCss, coverage, analyze, karma} = {
'Promise': 'bluebird'
}),
new ModuleDependenciesPlugin({
'aurelia-testing': [ './compile-spy', './view-spy' ]
'aurelia-testing': ['./compile-spy', './view-spy']
}),
new HtmlWebpackPlugin({
template: 'index.ejs',
Expand Down