You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 7, 2021. It is now read-only.
const{ relative, resolve, sep }=require("path");constwebpack=require("webpack");constCleanWebpackPlugin=require("clean-webpack-plugin");constCopyWebpackPlugin=require("copy-webpack-plugin");const{ BundleAnalyzerPlugin }=require("webpack-bundle-analyzer");constTerserPlugin=require('terser-webpack-plugin');constVueLoaderPlugin=require('vue-loader/lib/plugin');constNsVueTemplateCompiler=require("nativescript-vue-template-compiler");constnsWebpack=require("nativescript-dev-webpack");constnativescriptTarget=require("nativescript-dev-webpack/nativescript-target");const{ NativeScriptWorkerPlugin }=require("nativescript-worker-loader/NativeScriptWorkerPlugin");module.exports=env=>{// Add your custom Activities, Services and other android app components here.constappComponents=["tns-core-modules/ui/frame","tns-core-modules/ui/frame/activity",];constplatform=env&&(env.android&&"android"||env.ios&&"ios");if(!platform){thrownewError("You need to provide a target platform!");}constplatforms=["ios","android"];constprojectRoot=__dirname;// Default destination inside platforms/<platform>/...constdist=resolve(projectRoot,nsWebpack.getAppPath(platform,projectRoot));constappResourcesPlatformDir=platform==="android" ? "Android" : "iOS";const{// The 'appPath' and 'appResourcesPath' values are fetched from// the nsconfig.json configuration file// when bundling with `tns run android|ios --bundle`.
appPath ="app",
appResourcesPath ="app/App_Resources",// You can provide the following flags when running 'tns run android|ios'
snapshot,// --env.snapshot
production,// --env.production
report,// --env.report
hmr,// --env.hmr}=env;constexternals=(env.externals||[]).map((e)=>{// --env.externalsreturnnewRegExp(e+".*");});constmode=production ? "production" : "development"constappFullPath=resolve(projectRoot,appPath);constappResourcesFullPath=resolve(projectRoot,appResourcesPath);constentryModule=nsWebpack.getEntryModule(appFullPath);constentryPath=`.${sep}${entryModule}.ts`;console.log(`Bundling application for entryPath ${entryPath}...`);constconfig={mode: mode,context: appFullPath,
externals,watchOptions: {ignored: [appResourcesFullPath,// Don't watch hidden files"**/.*",],},target: nativescriptTarget,// target: nativeScriptVueTarget,entry: {bundle: entryPath,},output: {pathinfo: false,path: dist,libraryTarget: "commonjs2",filename: "[name].js",globalObject: "global",},resolve: {extensions: [".vue",".js",".ts",".scss",".css"],// Resolve {N} system modules from tns-core-modulesmodules: [resolve(__dirname,"node_modules/tns-core-modules"),resolve(__dirname,"node_modules"),"node_modules/tns-core-modules","node_modules",],alias: {'~': appFullPath,'@': appFullPath,'vue$': 'nativescript-vue'},// don't resolve symlinks to symlinked modulessymlinks: false,},resolveLoader: {// don't resolve symlinks to symlinked loaderssymlinks: false,},node: {// Disable node shims that conflict with NativeScript"http": false,"timers": false,"setImmediate": false,"fs": "empty","__dirname": false,},devtool: "none",optimization: {splitChunks: {cacheGroups: {vendor: {name: "vendor",chunks: "all",test: (module)=>{constmoduleName=module.nameForCondition ? module.nameForCondition() : '';return/[\\/]node_modules[\\/]/.test(moduleName)||appComponents.some(comp=>comp===moduleName);},enforce: true,},},},minimize: Boolean(production),minimizer: [newTerserPlugin({parallel: true,cache: true,terserOptions: {output: {comments: false,},compress: {// The Android SBG has problems parsing the output// when these options are enabled'collapse_vars': platform!=="android",sequences: platform!=="android",},safari10: platform==="ios",keep_fnames: true,},}),],},module: {rules: [{test: newRegExp(entryPath),use: [// Require all Android app componentsplatform==="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 appsloadCss: !snapshot,// load the application css if in debug mode},},].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: /\.ts$/,exclude: /node_modules|vue\/src/,loader: 'ts-loader',options: {appendTsSuffixTo: [/\.vue$/],allowTsInNodeModules: true,},},{test: /\.js$/,loader: 'babel-loader',},{test: /\.vue$/,loader: "vue-loader",options: {compiler: NsVueTemplateCompiler,},},],},plugins: [// ... Vue Loader plugin omitted// make sure to include the plugin!newVueLoaderPlugin(),// Define useful constants like TNS_WEBPACKnewwebpack.DefinePlugin({"global.TNS_WEBPACK": "true","TNS_ENV": JSON.stringify(mode)}),// Remove all files from the out dir.newCleanWebpackPlugin([`${dist}/**/*`]),// Copy native app resources to out dir.newCopyWebpackPlugin([{from: `${appResourcesFullPath}/${appResourcesPlatformDir}`,to: `${dist}/App_Resources/${appResourcesPlatformDir}`,context: projectRoot,}]),// Copy assets to out dir. Add your own globs as needed.newCopyWebpackPlugin([{from: "fonts/**"},{from: "**/*.+(jpg|png)"},{from: "assets/**/*"},],{ignore: [`${relative(appPath,appResourcesFullPath)}/**`]}),// Generate a bundle starter script and activate it in package.jsonnewnsWebpack.GenerateBundleStarterPlugin(["./vendor","./bundle",]),// For instructions on how to set up workers with webpack// check out https://github.com/nativescript/worker-loadernewNativeScriptWorkerPlugin(),newnsWebpack.PlatformFSPlugin({
platform,
platforms,}),// Does IPC communication with the {N} CLI to notify events when running in watch mode.newnsWebpack.WatchStateLoggerPlugin(),],};if(report){// Generate report files for bundles contentconfig.plugins.push(newBundleAnalyzerPlugin({analyzerMode: "static",openAnalyzer: false,generateStatsFile: true,reportFilename: resolve(projectRoot,"report",`report.html`),statsFilename: resolve(projectRoot,"report",`stats.json`),}));}if(snapshot){config.plugins.push(newnsWebpack.NativeScriptSnapshotPlugin({chunk: "vendor",requireModules: ["tns-core-modules/bundle-entry-points",],
projectRoot,webpackConfig: config,}));}if(hmr){config.plugins.push(newwebpack.HotModuleReplacementPlugin());}returnconfig;};
Describe the bug
When adding a simple class to a Label to your label, with the HMR enabled to App is upgrade, but is known. With javascript this problem does not happen.
To Reproduce
1- Create a new NativeScript vue with TypeScript vue init nativescript-vue/vue-cli-template <project-name>
2- Add a new Label, after reloading App, change the label text, or add a new class on the Label
Actual behavior
The changes are applied but the App is Restarted.
Expected behavior
The app should not restart.
Sample project
The official NativeScript Vue template with TypeScript
Environment
My package.json
My webpack.config
Describe the bug
When adding a simple class to a Label to your label, with the HMR enabled to App is upgrade, but is known. With javascript this problem does not happen.
To Reproduce
1- Create a new NativeScript vue with TypeScript
vue init nativescript-vue/vue-cli-template <project-name>
2- Add a new Label, after reloading App, change the label text, or add a new class on the Label
Actual behavior
The changes are applied but the App is Restarted.
Expected behavior
The app should not restart.
Sample project
The official NativeScript Vue template with TypeScript
Additional context
The text was updated successfully, but these errors were encountered: