11const path = require ( "path" ) ;
2- const CleanWebpackPlugin = require ( " clean-webpack-plugin" ) ;
2+ const { CleanWebpackPlugin} = require ( ' clean-webpack-plugin' ) ;
33const CopyWebpackPlugin = require ( "copy-webpack-plugin" ) ;
44const HtmlWebpackPlugin = require ( "html-webpack-plugin" ) ;
55
@@ -26,15 +26,9 @@ module.exports = {
2626 exclude : / n o d e _ m o d u l e s / ,
2727 test : / \. s c s s $ / ,
2828 use : [
29- {
30- loader : "style-loader" // Creates style nodes from JS strings
31- } ,
32- {
33- loader : "css-loader" // Translates CSS into CommonJS
34- } ,
35- {
36- loader : "sass-loader" // Compiles Sass to CSS
37- }
29+ { loader : "style-loader" } ,
30+ { loader : "css-loader" } ,
31+ { loader : "sass-loader" } ,
3832 ]
3933 } ,
4034 {
@@ -62,22 +56,24 @@ module.exports = {
6256 ]
6357 } ,
6458 plugins : [
65- // // expose and write the allowed env vars on the compiled bundle
66- // new webpack.DefinePlugin({
67- // "process.env.NODE_ENV": JSON.stringify(env.NODE_ENV)
68- // }),
69- new CleanWebpackPlugin ( "dist" ) ,
70- new CopyWebpackPlugin ( [ {
71- from : "src/manifest.json" ,
72- transform : function ( content , path ) {
73- // generates the manifest file using the package.json informations
74- return Buffer . from ( JSON . stringify ( {
75- description : process . env . npm_package_description ,
76- version : process . env . npm_package_version ,
77- ...JSON . parse ( content . toString ( ) )
78- } ) ) ;
79- }
80- } ] ) ,
59+ new CleanWebpackPlugin ( {
60+ dir : "dist"
61+ } ) ,
62+ new CopyWebpackPlugin ( {
63+ patterns : [
64+ {
65+ from : "src/manifest.json" ,
66+ transform : function ( content , path ) {
67+ // generates the manifest file using the package.json informations
68+ return Buffer . from ( JSON . stringify ( {
69+ description : process . env . npm_package_description ,
70+ version : process . env . npm_package_version ,
71+ ...JSON . parse ( content . toString ( ) )
72+ } ) ) ;
73+ }
74+ }
75+ ]
76+ } ) ,
8177 new HtmlWebpackPlugin ( {
8278 template : path . join ( __dirname , "src/inspector.html" ) ,
8379 filename : "inspector.html" ,
@@ -88,7 +84,6 @@ module.exports = {
8884 filename : "devtools.html" ,
8985 chunks : [ "devtools" ]
9086 } )
91- // ,new WriteFilePlugin()
9287 ] ,
9388 resolve : {
9489 extensions : [ ".ts" , ".tsx" , ".js" ]
0 commit comments