diff --git a/demo/AngularApp/webpack.config.js b/demo/AngularApp/webpack.config.js index 061ba840..cd20cf89 100644 --- a/demo/AngularApp/webpack.config.js +++ b/demo/AngularApp/webpack.config.js @@ -198,14 +198,14 @@ module.exports = env => { test: /[\/|\\]app\.css$/, use: [ "nativescript-dev-webpack/style-hot-loader", - { loader: "css-loader", options: { minimize: false, url: false } } + { loader: "css-loader", options: { url: false } } ] }, { test: /[\/|\\]app\.scss$/, use: [ "nativescript-dev-webpack/style-hot-loader", - { loader: "css-loader", options: { minimize: false, url: false } }, + { loader: "css-loader", options: { url: false } }, "sass-loader" ] }, diff --git a/demo/JavaScriptApp/webpack.config.js b/demo/JavaScriptApp/webpack.config.js index 7d08d7a8..19515f33 100644 --- a/demo/JavaScriptApp/webpack.config.js +++ b/demo/JavaScriptApp/webpack.config.js @@ -102,7 +102,7 @@ module.exports = env => { "__dirname": false, }, devtool: sourceMap ? "inline-source-map" : "none", - optimization: { + optimization: { splitChunks: { cacheGroups: { vendor: { @@ -111,7 +111,7 @@ module.exports = env => { test: (module, chunks) => { const moduleName = module.nameForCondition ? module.nameForCondition() : ''; return /[\\/]node_modules[\\/]/.test(moduleName) || - appComponents.some(comp => comp === moduleName); + appComponents.some(comp => comp === moduleName); }, enforce: true, @@ -172,17 +172,17 @@ module.exports = env => { use: "nativescript-dev-webpack/markup-hot-loader" }, - { test: /\.(html|xml)$/, use: "nativescript-dev-webpack/xml-namespace-loader"}, + { test: /\.(html|xml)$/, use: "nativescript-dev-webpack/xml-namespace-loader" }, { test: /\.css$/, - use: { loader: "css-loader", options: { minimize: false, url: false } } + use: { loader: "css-loader", options: { url: false } } }, { test: /\.scss$/, use: [ - { loader: "css-loader", options: { minimize: false, url: false } }, + { loader: "css-loader", options: { url: false } }, "sass-loader" ] }, @@ -195,14 +195,14 @@ module.exports = env => { "process": undefined, }), // Remove all files from the out dir. - new CleanWebpackPlugin([ `${dist}/**/*` ]), - // Copy native app resources to out dir. + new CleanWebpackPlugin([`${dist}/**/*`]), + // Copy native app resources to out dir. new CopyWebpackPlugin([ - { - from: `${appResourcesFullPath}/${appResourcesPlatformDir}`, - to: `${dist}/App_Resources/${appResourcesPlatformDir}`, - context: projectRoot - }, + { + from: `${appResourcesFullPath}/${appResourcesPlatformDir}`, + to: `${dist}/App_Resources/${appResourcesPlatformDir}`, + context: projectRoot + }, ]), // Copy assets to out dir. Add your own globs as needed. new CopyWebpackPlugin([ diff --git a/demo/TypeScriptApp/webpack.config.js b/demo/TypeScriptApp/webpack.config.js index 11df2183..2d2eff89 100644 --- a/demo/TypeScriptApp/webpack.config.js +++ b/demo/TypeScriptApp/webpack.config.js @@ -104,7 +104,7 @@ module.exports = env => { "__dirname": false, }, devtool: sourceMap ? "inline-source-map" : "none", - optimization: { + optimization: { splitChunks: { cacheGroups: { vendor: { @@ -113,7 +113,7 @@ module.exports = env => { test: (module, chunks) => { const moduleName = module.nameForCondition ? module.nameForCondition() : ''; return /[\\/]node_modules[\\/]/.test(moduleName) || - appComponents.some(comp => comp === moduleName); + appComponents.some(comp => comp === moduleName); }, enforce: true, @@ -174,17 +174,17 @@ module.exports = env => { use: "nativescript-dev-webpack/markup-hot-loader" }, - { test: /\.(html|xml)$/, use: "nativescript-dev-webpack/xml-namespace-loader"}, + { test: /\.(html|xml)$/, use: "nativescript-dev-webpack/xml-namespace-loader" }, { test: /\.css$/, - use: { loader: "css-loader", options: { minimize: false, url: false } } + use: { loader: "css-loader", options: { url: false } } }, { test: /\.scss$/, use: [ - { loader: "css-loader", options: { minimize: false, url: false } }, + { loader: "css-loader", options: { url: false } }, "sass-loader" ] }, @@ -209,14 +209,14 @@ module.exports = env => { "process": undefined, }), // Remove all files from the out dir. - new CleanWebpackPlugin([ `${dist}/**/*` ]), + new CleanWebpackPlugin([`${dist}/**/*`]), // Copy native app resources to out dir. new CopyWebpackPlugin([ - { - from: `${appResourcesFullPath}/${appResourcesPlatformDir}`, - to: `${dist}/App_Resources/${appResourcesPlatformDir}`, - context: projectRoot - }, + { + from: `${appResourcesFullPath}/${appResourcesPlatformDir}`, + to: `${dist}/App_Resources/${appResourcesPlatformDir}`, + context: projectRoot + }, ]), // Copy assets to out dir. Add your own globs as needed. new CopyWebpackPlugin([ diff --git a/package.json b/package.json index 6423ff34..0d235970 100644 --- a/package.json +++ b/package.json @@ -77,7 +77,7 @@ "@angular-devkit/core": "~7.2.0", "clean-webpack-plugin": "~1.0.0", "copy-webpack-plugin": "~4.6.0", - "css-loader": "~1.0.0", + "css-loader": "~2.1.1", "global-modules-path": "2.0.0", "minimatch": "3.0.4", "nativescript-hook": "0.2.4", diff --git a/templates/webpack.angular.js b/templates/webpack.angular.js index ed384adb..f6cdff9b 100644 --- a/templates/webpack.angular.js +++ b/templates/webpack.angular.js @@ -209,14 +209,14 @@ module.exports = env => { test: /[\/|\\]app\.css$/, use: [ "nativescript-dev-webpack/style-hot-loader", - { loader: "css-loader", options: { minimize: false, url: false } } + { loader: "css-loader", options: { url: false } } ] }, { test: /[\/|\\]app\.scss$/, use: [ "nativescript-dev-webpack/style-hot-loader", - { loader: "css-loader", options: { minimize: false, url: false } }, + { loader: "css-loader", options: { url: false } }, "sass-loader" ] }, diff --git a/templates/webpack.javascript.js b/templates/webpack.javascript.js index 626df1c3..a76f617d 100644 --- a/templates/webpack.javascript.js +++ b/templates/webpack.javascript.js @@ -8,7 +8,7 @@ const CopyWebpackPlugin = require("copy-webpack-plugin"); const { BundleAnalyzerPlugin } = require("webpack-bundle-analyzer"); const { NativeScriptWorkerPlugin } = require("nativescript-worker-loader/NativeScriptWorkerPlugin"); const UglifyJsPlugin = require("uglifyjs-webpack-plugin"); -const hashSalt = Date.now().toString(); +const hashSalt = Date.now().toString(); module.exports = env => { // Add your custom Activities, Services and other android app components here. @@ -113,7 +113,7 @@ module.exports = env => { test: (module, chunks) => { const moduleName = module.nameForCondition ? module.nameForCondition() : ''; return /[\\/]node_modules[\\/]/.test(moduleName) || - appComponents.some(comp => comp === moduleName); + appComponents.some(comp => comp === moduleName); }, enforce: true, @@ -177,17 +177,17 @@ module.exports = env => { use: "nativescript-dev-webpack/markup-hot-loader" }, - { test: /\.(html|xml)$/, use: "nativescript-dev-webpack/xml-namespace-loader"}, + { test: /\.(html|xml)$/, use: "nativescript-dev-webpack/xml-namespace-loader" }, { test: /\.css$/, - use: { loader: "css-loader", options: { minimize: false, url: false } } + use: { loader: "css-loader", options: { url: false } } }, { test: /\.scss$/, use: [ - { loader: "css-loader", options: { minimize: false, url: false } }, + { loader: "css-loader", options: { url: false } }, "sass-loader" ] }, @@ -200,7 +200,7 @@ module.exports = env => { "process": undefined, }), // Remove all files from the out dir. - new CleanWebpackPlugin([ `${dist}/**/*` ]), + new CleanWebpackPlugin([`${dist}/**/*`]), // Copy assets to out dir. Add your own globs as needed. new CopyWebpackPlugin([ { from: { glob: "fonts/**" } }, @@ -213,10 +213,10 @@ module.exports = env => { // configures the WebPack runtime to be generated inside the snapshot // module and no `runtime.js` module exist. (snapshot ? [] : ["./runtime"]) - .concat([ - "./vendor", - "./bundle", - ]) + .concat([ + "./vendor", + "./bundle", + ]) ), // For instructions on how to set up workers with webpack // check out https://github.com/nativescript/worker-loader diff --git a/templates/webpack.typescript.js b/templates/webpack.typescript.js index 5e7903ba..ab026e40 100644 --- a/templates/webpack.typescript.js +++ b/templates/webpack.typescript.js @@ -8,7 +8,7 @@ const CopyWebpackPlugin = require("copy-webpack-plugin"); const { BundleAnalyzerPlugin } = require("webpack-bundle-analyzer"); const { NativeScriptWorkerPlugin } = require("nativescript-worker-loader/NativeScriptWorkerPlugin"); const UglifyJsPlugin = require("uglifyjs-webpack-plugin"); -const hashSalt = Date.now().toString(); +const hashSalt = Date.now().toString(); module.exports = env => { // Add your custom Activities, Services and other Android app components here. @@ -115,7 +115,7 @@ module.exports = env => { test: (module, chunks) => { const moduleName = module.nameForCondition ? module.nameForCondition() : ''; return /[\\/]node_modules[\\/]/.test(moduleName) || - appComponents.some(comp => comp === moduleName); + appComponents.some(comp => comp === moduleName); }, enforce: true, @@ -179,17 +179,17 @@ module.exports = env => { use: "nativescript-dev-webpack/markup-hot-loader" }, - { test: /\.(html|xml)$/, use: "nativescript-dev-webpack/xml-namespace-loader"}, + { test: /\.(html|xml)$/, use: "nativescript-dev-webpack/xml-namespace-loader" }, { test: /\.css$/, - use: { loader: "css-loader", options: { minimize: false, url: false } } + use: { loader: "css-loader", options: { url: false } } }, { test: /\.scss$/, use: [ - { loader: "css-loader", options: { minimize: false, url: false } }, + { loader: "css-loader", options: { url: false } }, "sass-loader" ] }, @@ -213,7 +213,7 @@ module.exports = env => { "process": undefined, }), // Remove all files from the out dir. - new CleanWebpackPlugin([ `${dist}/**/*` ]), + new CleanWebpackPlugin([`${dist}/**/*`]), // Copy assets to out dir. Add your own globs as needed. new CopyWebpackPlugin([ { from: { glob: "fonts/**" } }, @@ -226,10 +226,10 @@ module.exports = env => { // configures the WebPack runtime to be generated inside the snapshot // module and no `runtime.js` module exist. (snapshot ? [] : ["./runtime"]) - .concat([ - "./vendor", - "./bundle", - ]) + .concat([ + "./vendor", + "./bundle", + ]) ), // For instructions on how to set up workers with webpack // check out https://github.com/nativescript/worker-loader diff --git a/templates/webpack.vue.js b/templates/webpack.vue.js index 298917e6..323c1698 100644 --- a/templates/webpack.vue.js +++ b/templates/webpack.vue.js @@ -12,7 +12,7 @@ const NsVueTemplateCompiler = require("nativescript-vue-template-compiler"); const nsWebpack = require("nativescript-dev-webpack"); const nativescriptTarget = require("nativescript-dev-webpack/nativescript-target"); const { NativeScriptWorkerPlugin } = require("nativescript-worker-loader/NativeScriptWorkerPlugin"); -const hashSalt = Date.now().toString(); +const hashSalt = Date.now().toString(); module.exports = env => { // Add your custom Activities, Services and other android app components here. @@ -155,62 +155,62 @@ module.exports = env => { }, module: { rules: [{ - test: nsWebpack.getEntryPathRegExp(appFullPath, entryPath + ".(js|ts)"), - use: [ - // Require all Android app components - platform === "android" && { - loader: "nativescript-dev-webpack/android-app-components-loader", - options: { modules: appComponents }, - }, + test: nsWebpack.getEntryPathRegExp(appFullPath, entryPath + ".(js|ts)"), + use: [ + // Require all Android app components + platform === "android" && { + loader: "nativescript-dev-webpack/android-app-components-loader", + options: { modules: appComponents }, + }, - { - loader: "nativescript-dev-webpack/bundle-config-loader", - options: { - registerPages: true, // applicable only for non-angular apps - loadCss: !snapshot, // load the application css if in debug mode - unitTesting, - appFullPath, - projectRoot, - }, + { + loader: "nativescript-dev-webpack/bundle-config-loader", + options: { + registerPages: true, // applicable only for non-angular apps + loadCss: !snapshot, // load the application css if in debug mode + unitTesting, + appFullPath, + projectRoot, }, - ].filter(loader => Boolean(loader)), - }, - { - test: /\.css$/, - use: [ - 'nativescript-dev-webpack/style-hot-loader', - 'nativescript-dev-webpack/apply-css-loader.js', - { loader: "css-loader", options: { minimize: false, url: false } }, - ], - }, - { - test: /\.scss$/, - use: [ - 'nativescript-dev-webpack/style-hot-loader', - 'nativescript-dev-webpack/apply-css-loader.js', - { loader: "css-loader", options: { minimize: false, url: false } }, - "sass-loader", - ], - }, - { - test: /\.js$/, - loader: 'babel-loader', - }, - { - test: /\.ts$/, - loader: 'ts-loader', - options: { - appendTsSuffixTo: [/\.vue$/], - allowTsInNodeModules: true, }, + ].filter(loader => Boolean(loader)), + }, + { + test: /\.css$/, + use: [ + 'nativescript-dev-webpack/style-hot-loader', + 'nativescript-dev-webpack/apply-css-loader.js', + { loader: "css-loader", options: { url: false } }, + ], + }, + { + test: /\.scss$/, + use: [ + 'nativescript-dev-webpack/style-hot-loader', + 'nativescript-dev-webpack/apply-css-loader.js', + { loader: "css-loader", options: { url: false } }, + "sass-loader", + ], + }, + { + test: /\.js$/, + loader: 'babel-loader', + }, + { + test: /\.ts$/, + loader: 'ts-loader', + options: { + appendTsSuffixTo: [/\.vue$/], + allowTsInNodeModules: true, }, - { - test: /\.vue$/, - loader: "vue-loader", - options: { - compiler: NsVueTemplateCompiler, - }, + }, + { + test: /\.vue$/, + loader: "vue-loader", + options: { + compiler: NsVueTemplateCompiler, }, + }, ], }, plugins: [ @@ -236,10 +236,10 @@ module.exports = env => { // configures the WebPack runtime to be generated inside the snapshot // module and no `runtime.js` module exist. (snapshot ? [] : ["./runtime"]) - .concat([ - "./vendor", - "./bundle", - ]) + .concat([ + "./vendor", + "./bundle", + ]) ), // For instructions on how to set up workers with webpack // check out https://github.com/nativescript/worker-loader @@ -264,7 +264,7 @@ module.exports = env => { use: "nativescript-dev-webpack/markup-hot-loader" }, - { test: /\.(html|xml)$/, use: "nativescript-dev-webpack/xml-namespace-loader"} + { test: /\.(html|xml)$/, use: "nativescript-dev-webpack/xml-namespace-loader" } ); }