@@ -7,6 +7,7 @@ const { nsReplaceBootstrap } = require("nativescript-dev-webpack/transformers/ns
77const { nsReplaceLazyLoader } = require ( "nativescript-dev-webpack/transformers/ns-replace-lazy-loader" ) ;
88const { nsSupportHmrNg } = require ( "nativescript-dev-webpack/transformers/ns-support-hmr-ng" ) ;
99const { getMainModulePath } = require ( "nativescript-dev-webpack/utils/ast-utils" ) ;
10+ const { getNoEmitOnErrorFromTSConfig } = require ( "nativescript-dev-webpack/utils/tsconfig-utils" ) ;
1011const CleanWebpackPlugin = require ( "clean-webpack-plugin" ) ;
1112const CopyWebpackPlugin = require ( "copy-webpack-plugin" ) ;
1213const { BundleAnalyzerPlugin } = require ( "webpack-bundle-analyzer" ) ;
@@ -35,8 +36,7 @@ module.exports = env => {
3536
3637 const {
3738 // The 'appPath' and 'appResourcesPath' values are fetched from
38- // the nsconfig.json configuration file
39- // when bundling with `tns run android|ios --bundle`.
39+ // the nsconfig.json configuration file.
4040 appPath = "src" ,
4141 appResourcesPath = "App_Resources" ,
4242
@@ -51,8 +51,12 @@ module.exports = env => {
5151 hmr, // --env.hmr,
5252 unitTesting, // --env.unitTesting
5353 verbose, // --env.verbose
54+ snapshotInDocker, // --env.snapshotInDocker
55+ skipSnapshotTools, // --env.skipSnapshotTools
56+ compileSnapshot // --env.compileSnapshot
5457 } = env ;
5558
59+ const useLibs = compileSnapshot ;
5660 const isAnySourceMapEnabled = ! ! sourceMap || ! ! hiddenSourceMap ;
5761 const externals = nsWebpack . getConvertedExternals ( env . externals ) ;
5862 const appFullPath = resolve ( projectRoot , appPath ) ;
@@ -108,6 +112,8 @@ module.exports = env => {
108112 itemsToClean . push ( `${ join ( projectRoot , "platforms" , "android" , "app" , "build" , "configurations" , "nativescript-android-snapshot" ) } ` ) ;
109113 }
110114
115+ const noEmitOnErrorFromTSConfig = getNoEmitOnErrorFromTSConfig ( join ( projectRoot , tsConfigName ) ) ;
116+
111117 nsWebpack . processAppComponents ( appComponents , platform ) ;
112118 const config = {
113119 mode : production ? "production" : "development" ,
@@ -159,6 +165,7 @@ module.exports = env => {
159165 devtool : hiddenSourceMap ? "hidden-source-map" : ( sourceMap ? "inline-source-map" : "none" ) ,
160166 optimization : {
161167 runtimeChunk : "single" ,
168+ noEmitOnErrors : noEmitOnErrorFromTSConfig ,
162169 splitChunks : {
163170 cacheGroups : {
164171 vendor : {
@@ -221,19 +228,24 @@ module.exports = env => {
221228
222229 { test : / \. h t m l $ | \. x m l $ / , use : "raw-loader" } ,
223230
224- // tns-core-modules reads the app.css and its imports using css-loader
225231 {
226232 test : / [ \/ | \\ ] a p p \. c s s $ / ,
227233 use : [
228234 "nativescript-dev-webpack/style-hot-loader" ,
229- { loader : "css-loader" , options : { url : false } }
235+ {
236+ loader : "nativescript-dev-webpack/css2json-loader" ,
237+ options : { useForImports : true }
238+ }
230239 ]
231240 } ,
232241 {
233242 test : / [ \/ | \\ ] a p p \. s c s s $ / ,
234243 use : [
235244 "nativescript-dev-webpack/style-hot-loader" ,
236- { loader : "css-loader" , options : { url : false } } ,
245+ {
246+ loader : "nativescript-dev-webpack/css2json-loader" ,
247+ options : { useForImports : true }
248+ } ,
237249 "sass-loader"
238250 ]
239251 } ,
@@ -272,7 +284,6 @@ module.exports = env => {
272284 { from : { glob : "fonts/**" } } ,
273285 { from : { glob : "**/*.jpg" } } ,
274286 { from : { glob : "**/*.png" } } ,
275- { from : { glob : "custommodel/**" } } ,
276287 ] , { ignore : [ `${ relative ( appPath , appResourcesFullPath ) } /**` ] } ) ,
277288 new nsWebpack . GenerateNativeScriptEntryPointsPlugin ( "bundle" ) ,
278289 // For instructions on how to set up workers with webpack
@@ -310,6 +321,9 @@ module.exports = env => {
310321 ] ,
311322 projectRoot,
312323 webpackConfig : config ,
324+ snapshotInDocker,
325+ skipSnapshotTools,
326+ useLibs
313327 } ) ) ;
314328 }
315329
0 commit comments