@@ -2,34 +2,39 @@ const path = require('path');
22// const ESLintPlugin = require('eslint-webpack-plugin');
33const CopyPlugin = require ( 'copy-webpack-plugin' ) ;
44
5- module . exports = {
6- entry : {
7- main : [ './src/content.js' , './src/utils.js' ] ,
8- settings : [ './src/settings.js' , './src/utils.js' ] ,
9- background : [ './src/background.js' ] ,
10- } ,
11- output : {
12- filename : '[name].bundle.js' ,
13- path : path . resolve ( __dirname , 'distribution/lib' ) ,
14- } ,
15- devtool : 'inline-source-map' ,
16- plugins : [
17- // new ESLintPlugin({
18- // // /*options*/ useEslintrc: true,
19- // }),
20- new CopyPlugin ( {
21- patterns : [
22- {
23- from : './node_modules/bootstrap/dist/js/bootstrap.min.js' ,
24- to : path . resolve ( __dirname , 'distribution/dependencies' ) ,
25- force : true ,
26- } ,
27- {
28- from : './node_modules/bootstrap/dist/css/bootstrap.min.css' ,
29- to : path . resolve ( __dirname , 'distribution/dependencies' ) ,
30- force : true ,
31- } ,
32- ] ,
33- } ) ,
34- ] ,
5+ module . exports = ( env , argv ) => {
6+ const isProduction = argv . mode === 'production' ;
7+
8+ return {
9+ entry : {
10+ main : [ './src/content.js' , './src/utils.js' ] ,
11+ settings : [ './src/settings.js' , './src/utils.js' ] ,
12+ background : [ './src/background.js' ] ,
13+ } ,
14+ output : {
15+ filename : '[name].bundle.js' ,
16+ path : path . resolve ( __dirname , 'distribution/lib' ) ,
17+ } ,
18+ // Use source maps in both dev and production for better debugging and validation
19+ devtool : isProduction ? 'source-map' : 'inline-source-map' ,
20+ plugins : [
21+ // new ESLintPlugin({
22+ // // /*options*/ useEslintrc: true,
23+ // }),
24+ new CopyPlugin ( {
25+ patterns : [
26+ {
27+ from : './node_modules/bootstrap/dist/js/bootstrap.min.js' ,
28+ to : path . resolve ( __dirname , 'distribution/dependencies' ) ,
29+ force : true ,
30+ } ,
31+ {
32+ from : './node_modules/bootstrap/dist/css/bootstrap.min.css' ,
33+ to : path . resolve ( __dirname , 'distribution/dependencies' ) ,
34+ force : true ,
35+ } ,
36+ ] ,
37+ } ) ,
38+ ] ,
39+ } ;
3540} ;
0 commit comments