diff --git a/test/manual/watch-dependencies-import-js/package.json b/test/manual/watch-dependencies-import-js/package.json new file mode 100644 index 00000000..cfa38ad2 --- /dev/null +++ b/test/manual/watch-dependencies-import-js/package.json @@ -0,0 +1,11 @@ +{ + "description": "IMPORTANT: don't install webpack here because the Webpack instance MUST be one, otherwise appear the error: The 'compilation' argument must be an instance of Compilation.", + "scripts": { + "start": "webpack serve --mode development", + "watch": "webpack watch --mode development", + "build": "webpack --mode=production --progress" + }, + "devDependencies": { + "html-bundler-webpack-plugin": "file:../../.." + } +} diff --git a/test/manual/watch-dependencies-import-js/src/index.html b/test/manual/watch-dependencies-import-js/src/index.html new file mode 100644 index 00000000..9f165c97 --- /dev/null +++ b/test/manual/watch-dependencies-import-js/src/index.html @@ -0,0 +1,11 @@ + + + + Home + + + +

Hello World!

+

Change the content of an imported JS file.

+ + \ No newline at end of file diff --git a/test/manual/watch-dependencies-import-js/src/main.js b/test/manual/watch-dependencies-import-js/src/main.js new file mode 100644 index 00000000..856c0908 --- /dev/null +++ b/test/manual/watch-dependencies-import-js/src/main.js @@ -0,0 +1,4 @@ +// test in serv mode: change the content of the imported file +import str from './module'; + +console.log('>> main', { str }); diff --git a/test/manual/watch-dependencies-import-js/src/module.js b/test/manual/watch-dependencies-import-js/src/module.js new file mode 100644 index 00000000..3f090786 --- /dev/null +++ b/test/manual/watch-dependencies-import-js/src/module.js @@ -0,0 +1 @@ +module.exports = 'Test 123'; diff --git a/test/manual/watch-dependencies-import-js/webpack.config.js b/test/manual/watch-dependencies-import-js/webpack.config.js new file mode 100644 index 00000000..bb35f1f9 --- /dev/null +++ b/test/manual/watch-dependencies-import-js/webpack.config.js @@ -0,0 +1,43 @@ +const path = require('path'); +const HtmlBundlerPlugin = require('html-bundler-webpack-plugin'); + +module.exports = { + mode: 'production', + stats: 'minimal', + + output: { + path: path.join(__dirname, 'dist/'), + }, + + plugins: [ + new HtmlBundlerPlugin({ + // auto processing templates in the path + entry: { + index: './src/index.html', + }, + + // test: configure paths to watch file changes + // watchFiles: { + // paths: ['./src'], + // //files: [/\.(html|js|sc?ss)$/], + // //ignore: [], + // }, + + verbose: true, + }), + ], + + // enable live reload + devServer: { + //hot: false, + static: { + directory: path.join(__dirname, 'dist'), + }, + watchFiles: { + paths: ['src/**/*.*'], + options: { + usePolling: true, + }, + }, + }, +};