Skip to content

Commit

Permalink
Watch other resources (dojo#226)
Browse files Browse the repository at this point in the history
Use the extra-watch-webpack-plugin to watch all files not in
dot folders, output, or node_modules.
  • Loading branch information
Bradley Maier authored and Bradley Maier committed Jan 2, 2019
1 parent 634ed39 commit 6157bf2
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 57 deletions.
88 changes: 36 additions & 52 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@
"eventsource-polyfill": "0.9.6",
"express": "4.16.2",
"express-static-gzip": "1.1.3",
"extra-watch-webpack-plugin": "^1.0.3",
"file-loader": "2.0.0",
"globby": "7.1.1",
"gzip-size": "4.1.0",
Expand Down
8 changes: 7 additions & 1 deletion src/base.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const IgnorePlugin = require('webpack/lib/IgnorePlugin');
const slash = require('slash');
const WrapperPlugin = require('wrapper-webpack-plugin');
const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin');
const ExtraWatchWebpackPlugin = require('extra-watch-webpack-plugin');

const basePath = process.cwd();
const srcPath = path.join(basePath, 'src');
Expand Down Expand Up @@ -168,6 +169,7 @@ export default function webpackConfigFactory(args: any): webpack.Configuration {
);
const isTest = args.mode === 'unit' || args.mode === 'functional' || args.mode === 'test';
const singleBundle = args.singleBundle || isTest;
const watch = args.watch;
let entry: any;
if (singleBundle) {
entry = {
Expand Down Expand Up @@ -401,6 +403,10 @@ export default function webpackConfigFactory(args: any): webpack.Configuration {
has: 'web-animations'
}
]
}),
watch &&
new ExtraWatchWebpackPlugin({
files: ['!(output|.*)/**']
})
]),
module: {
Expand All @@ -417,7 +423,7 @@ export default function webpackConfigFactory(args: any): webpack.Configuration {
}
},
{
test: /\.(css|js)$/,
test: /\.(css|js)/,
issuer: indexHtmlPattern,
loader: 'file-loader?hash=sha512&digest=hex&name=[name].[hash:base64:8].[ext]'
},
Expand Down
8 changes: 4 additions & 4 deletions test-app/package-lock.json

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

0 comments on commit 6157bf2

Please sign in to comment.