Environment
Describe the bug
Getting error while build the app with snapshot, release, aot, uglify flags
ERROR in NativeScriptSnapshot. Snapshot generation failed!
Target architecture: x86
/bin/sh: /var/folders/3f/rghyfz7x58z_d2g_95dk0b980000gn/T/snapshot-tools/mksnapshot-tools/v8-v6.9.427.23/darwin-x64/mksnapshot-ia32: Bad CPU type in executable
The build was worked fine before updating the MAC os to catalina. Before the mac os version was Mojave
Hi @ppyoosuf,
This is a known limitation while building an app with a Snapshot on Mac OS Catalina. This has been logged here. This problem is already fixed. To use Snapshot with the new os, you can follow the steps below:
nativescript-dev-webpack in your application -> 1.2.1platforms, node_modules, hooks folders and package-lock.json fileAny other solution without upgrading the nativescript-dev-webpack ?
Currently, upgrading nativescript-dev-webpack to the latest version is the only solution.
Hi @tsonevn,
Our team has ran into this issue (generating snapshots on mac catalina) with the latest nativescript-dev-webpack (1.3.0). Also tried the steps above and installed docker w/o build success. Even explicitly passed the flag enabling docker builds to the snapshot config.
I'm pasting the output, and other files for reference. Not sure if it matters, but we have a lazy loading setup. Not sure if the warning has something to do with this issue.
output
```[!] Exit status of command 'tns build android --release --bundle --env.uglify --env.aot --env.production --env.snapshot --key-store-path $KEYSTORE_FILE --key-store-password $KEYSTORE_PASSWORD --key-store-alias $KEYSTORE_ALIAS --key-store-alias-password $KEYSTORE_PASSWORD' was 127 instead of 0. (FastlaneCore::Interface::FastlaneShellError)
Preparing project...
Choosen entry path: ./main.aot.ts
Project root: /Users/ddiaz/workspace/calcourtapp
Snapshots build directory: /Users/ddiaz/workspace/calcourtapp/platforms/android/app/snapshot-build/build
Snapshotting bundle from /Users/ddiaz/workspace/calcourtapp/platforms/android/app/src/main/assets/app/snapshot-entry.js,/Users/ddiaz/workspace/calcourtapp/platforms/android/app/src/main/assets/app/vendor.js
Running snapshot generation with the following arguments:
{
"inputFiles": [
"/Users/ddiaz/workspace/calcourtapp/platforms/android/app/src/main/assets/app/snapshot-entry.js",
"/Users/ddiaz/workspace/calcourtapp/platforms/android/app/src/main/assets/app/vendor.js"
],
"preprocessedInputFile": "/Users/ddiaz/workspace/calcourtapp/platforms/android/app/src/main/assets/app/_embedded_script_.js",
"useLibs": false,
"skipSnapshotTools": false
}
Snapshot tools path: /var/folders/7r/v76f09g936x0br_32bzrdd54z3cwsr/T/snapshot-tools
Starting snapshot generation using V8 version: 7.6.303.28
Starting from macOS Catalina, the 32-bit processes are no longer supported. The snapshots will be generated in a docker container.
Webpack compilation complete.
Generating snapshot for armeabi-v7a *
Hash: 0b49db7abb460be726c6
Version: webpack 4.27.1
Time: 35297ms
Built at: 12/10/2019 4:35:31 PM
Asset Size Chunks Chunk Names
1.js 40 KiB 1 [emitted]
10.js 28.3 KiB 10 [emitted]
11.js 29.3 KiB 11 [emitted]
12.js 9.06 KiB 12 [emitted]
13.js 43 KiB 13 [emitted]
14.js 8.49 KiB 14 [emitted]
15.js 7.7 KiB 15 [emitted]
16.js 38.6 KiB 16 [emitted]
4.js 139 KiB 4 [emitted]
5.js 43.9 KiB 5 [emitted]
6.js 75.6 KiB 6 [emitted]
7.js 40.5 KiB 7 [emitted]
8.js 24.9 KiB 8 [emitted]
9.js 15.6 KiB 9 [emitted]
assets/css/fontawesome-all.css 87.9 KiB [emitted]
bundle.js 105 KiB 3, 1 [emitted] bundle
fonts/Montserrat-Regular.ttf 257 KiB [emitted]
fonts/Montserrat-SemiBold.ttf 255 KiB [emitted]
fonts/Montserrat-Thin.ttf 253 KiB [emitted]
fonts/RobotoRegular.ttf 123 KiB [emitted]
fonts/fa-brands-400.ttf 123 KiB [emitted]
fonts/fa-light-300.ttf 396 KiB [emitted]
fonts/fa-solid-900.ttf 306 KiB [emitted]
package.json 183 bytes [emitted]
snapshot-entry.js 22.4 KiB 2 [emitted] snapshot-entry
tns-java-classes.js 0 bytes [emitted]
vendor.js 2.13 MiB 0 [emitted] vendor
Entrypoint bundle = snapshot-entry.js vendor.js bundle.js
Entrypoint snapshot-entry = snapshot-entry.js vendor.js
[5] ../node_modules/@angular/router/fesm5/router.js + 13 modules 247 KiB {0} [built]
| 14 modules
[21] ./core/services/haptic-feedback.service.ts 842 bytes {1} {3} [built]
[29] ./core/services/logger.service.ts 1.77 KiB {1} {3} [built]
[38] ./core/services/auth.service.ts + 1 modules 3.29 KiB {1} {3} [built]
| ./core/services/auth.service.ts 3.02 KiB [built]
| ./utils/net.ts 230 bytes [built]
[48] ./core/services/remote-config.service.ts 3.16 KiB {1} {3} [built]
[51] ./core/services/portal-api-service.ts 2.23 KiB {1} {3} [built]
[54] ./core/services/connection.service.ts 2.02 KiB {1} {3} [built]
[69] ../node_modules/rxjs/_esm5/index.js + 41 modules 74.9 KiB {0} [built]
| 42 modules
[70] ./core/services/app-info.service.ts 724 bytes {1} {3} [built]
[78] ./core/services/local-storage.service.ts 576 bytes {1} {3} [built]
[81] ./core/services/debugger-store.service.ts 567 bytes {1} {3} [built]
[91] ./core/services/analytics.service.ts 3.31 KiB {1} {3} [built]
[354] ./app.module.ngfactory.js + 22 modules 93.7 KiB {3} [built]
| ./app.module.ngfactory.js 15.1 KiB [built]
| ./app.module.ts 1.48 KiB [built]
| ./app.component.ts 1.17 KiB [built]
| ./modules/splash/splash.component.ts 3.57 KiB [built]
| ./modules/splash/splash.component.ngfactory.js 2.03 KiB [built]
| ./modules/debugger/debugger.component.ts 822 bytes [built]
| ./modules/debugger/debugger.component.ngfactory.js 4.34 KiB [built]
| ./modules/auth/auth.component.ngfactory.js 11.1 KiB [built]
| ./modules/reminder/reminder.component.ngfactory.js 23 KiB [built]
| ./app.component.ngfactory.js 1.94 KiB [built]
| ./app-routing.module.ts 2.13 KiB [built]
| ./modules/auth/auth.module.ts 132 bytes [built]
| ./modules/debugger/debugger-routing.module.ts 319 bytes [built]
| ./modules/debugger/debugger.module.ts 148 bytes [built]
| ./modules/reminder/reminder.module.ts 317 bytes [built]
| + 8 hidden modules
[368] ./main.aot.ts 1.38 KiB {3} [built]
[522] ../platforms/android/app/snapshot-entry.js 323 bytes {2} [built]
+ 619 hidden modules
WARNING in Lazy routes discovery is not enabled. Because there is neither an entryModule nor a statically analyzable bootstrap code in the main file.
ERROR in NativeScriptSnapshot. Snapshot generation failed!
Target architecture: armeabi-v7a
#
#
#
#
==== C stack trace ===============================
/app/tmp/mksnapshot-tools/v8-v7.6.303.28/linux-x64/mksnapshot-arm(+0xd5073f) [0x572cb73f]
/app/tmp/mksnapshot-tools/v8-v7.6.303.28/linux-x64/mksnapshot-arm(+0xd4fc45) [0x572cac45]
/app/tmp/mksnapshot-tools/v8-v7.6.303.28/linux-x64/mksnapshot-arm(+0xd4b22f) [0x572c622f]
/app/tmp/mksnapshot-tools/v8-v7.6.303.28/linux-x64/mksnapshot-arm(+0xc1b62) [0x5663cb62]
/lib/i386-linux-gnu/libc.so.6(__libc_start_main+0xf1) [0xf740ae81]
JavaScript execution error: TypeError: t.registerModule is not a function
at /Users/ddiaz/workspace/calcourtapp/platforms/android/app/src/main/assets/app/_embedded_script_.js:37:2194316
at e.exports (/Users/ddiaz/workspace/calcourtapp/platforms/android/app/src/main/assets/app/_embedded_script_.js:37:2194475)
at e.exports (/Users/ddiaz/workspace/calcourtapp/platforms/android/app/src/main/assets/app/_embedded_script_.js:37:2194301)
at Object.522 (/Users/ddiaz/workspace/calcourtapp/platforms/android/app/src/main/assets/app/_embedded_script_.js:36:22924)
at e (/Users/ddiaz/workspace/calcourtapp/platforms/android/app/src/main/assets/app/_embedded_script_.js:36:515)
at o (/Users/ddiaz/workspace/calcourtapp/platforms/android/app/src/main/assets/app/_embedded_script_.js:36:391)
at Array.t [as push] (/Users/ddiaz/workspace/calcourtapp/platforms/android/app/src/main/assets/app/_embedded_script_.js:36:252)
at Object.
at Module._compile (/Users/ddiaz/workspace/calcourtapp/node_modules/v8-compile-cache/v8-compile-cache.js:194:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:749:10)
at Module.load (internal/modules/cjs/loader.js:630:32)
at tryModuleLoad (internal/modules/cjs/loader.js:570:12)
at Function.Module._load (internal/modules/cjs/loader.js:562:3)
at Module.require (internal/modules/cjs/loader.js:667:17)
at require (/Users/ddiaz/workspace/calcourtapp/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
at SnapshotGenerator.handleSnapshotToolResult (/Users/ddiaz/workspace/calcourtapp/node_modules/nativescript-dev-webpack/snapshot/android/snapshot-generator.js:344:13)
at child_process.exec (/Users/ddiaz/workspace/calcourtapp/node_modules/nativescript-dev-webpack/snapshot/android/snapshot-generator.js:439:40)
at ChildProcess.exithandler (child_process.js:304:5)
at ChildProcess.emit (events.js:197:13)
at maybeClose (internal/child_process.js:984:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:265:5)$
Executing webpack failed with exit code 2.
webpack.config.js
const { join, relative, resolve, sep, dirname } = require("path");
const webpack = require("webpack");
const nsWebpack = require("nativescript-dev-webpack");
const nativescriptTarget = require("nativescript-dev-webpack/nativescript-target");
const { nsReplaceBootstrap } = require("nativescript-dev-webpack/transformers/ns-replace-bootstrap");
const { nsReplaceLazyLoader } = require("nativescript-dev-webpack/transformers/ns-replace-lazy-loader");
const { nsSupportHmrNg } = require("nativescript-dev-webpack/transformers/ns-support-hmr-ng");
const { getMainModulePath } = require("nativescript-dev-webpack/utils/ast-utils");
const CleanWebpackPlugin = require("clean-webpack-plugin");
const CopyWebpackPlugin = require("copy-webpack-plugin");
const { BundleAnalyzerPlugin } = require("webpack-bundle-analyzer");
const { NativeScriptWorkerPlugin } = require("nativescript-worker-loader/NativeScriptWorkerPlugin");
const TerserPlugin = require("terser-webpack-plugin");
const { getAngularCompilerPlugin } = require("nativescript-dev-webpack/plugins/NativeScriptAngularCompilerPlugin");
const hashSalt = Date.now().toString();
const determineEntryPoint = (production, fullPath, platform) => {
const entryModule = nsWebpack.getEntryModule(fullPath, platform);
return production ? `${entryModule}.aot.ts` : `${entryModule}.ts`;
}
module.exports = env => {
// Add your custom Activities, Services and other Android app components here.
const appComponents = [
"tns-core-modules/ui/frame",
"tns-core-modules/ui/frame/activity",
];
const platform = env && (env.android && "android" || env.ios && "ios");
if (!platform) {
throw new Error("You need to provide a target platform!");
}
const AngularCompilerPlugin = getAngularCompilerPlugin(platform);
const projectRoot = __dirname;
// Default destination inside platforms/<platform>/...
const dist = resolve(projectRoot, nsWebpack.getAppPath(platform, projectRoot));
const {
// The 'appPath' and 'appResourcesPath' values are fetched from
// the nsconfig.json configuration file.
appPath = "src",
appResourcesPath = "App_Resources",
// You can provide the following flags when running 'tns run android|ios'
aot, // --env.aot
snapshot, // --env.snapshot,
production, // --env.production
uglify, // --env.uglify
report, // --env.report
sourceMap = false, // --env.sourceMap
hiddenSourceMap = false, // --env.hiddenSourceMap
hmr, // --env.hmr,
unitTesting, // --env.unitTesting
verbose, // --env.verbose
} = env;
const isAnySourceMapEnabled = !!sourceMap || !!hiddenSourceMap;
const externals = nsWebpack.getConvertedExternals(env.externals);
const appFullPath = resolve(projectRoot, appPath);
const appResourcesFullPath = resolve(projectRoot, appResourcesPath);
const tsConfigName = "tsconfig.tns.json";
const entryModule = determineEntryPoint(production, appFullPath, platform);
const entryPath = `.${sep}${entryModule}`;
console.log(`Choosen entry path: ${entryPath}`);
const devtool = hiddenSourceMap ? "hidden-source-map" : (sourceMap ? "inline-source-map" : "none")
const entries = { bundle: entryPath };
const areCoreModulesExternal = Array.isArray(env.externals) && env.externals.some(e => e.indexOf("tns-core-modules") > -1);
if (platform === "ios" && !areCoreModulesExternal) {
entries["tns_modules/tns-core-modules/inspector_modules"] = "inspector_modules";
};
const ngCompilerTransformers = [];
const additionalLazyModuleResources = [];
if (aot) {
ngCompilerTransformers.push(nsReplaceBootstrap);
}
if (hmr) {
ngCompilerTransformers.push(nsSupportHmrNg);
}
// when "@angular/core" is external, it's not included in the bundles. In this way, it will be used
// directly from node_modules and the Angular modules loader won't be able to resolve the lazy routes
// fixes https://github.com/NativeScript/nativescript-cli/issues/4024
if (env.externals && env.externals.indexOf("@angular/core") > -1) {
const appModuleRelativePath = getMainModulePath(resolve(appFullPath, entryModule), tsConfigName);
if (appModuleRelativePath) {
const appModuleFolderPath = dirname(resolve(appFullPath, appModuleRelativePath));
// include the lazy loader inside app module
ngCompilerTransformers.push(nsReplaceLazyLoader);
// include the new lazy loader path in the allowed ones
additionalLazyModuleResources.push(appModuleFolderPath);
}
}
const ngCompilerPlugin = new AngularCompilerPlugin({
hostReplacementPaths: nsWebpack.getResolver([platform, "tns"]),
platformTransformers: ngCompilerTransformers.map(t => t(() => ngCompilerPlugin, resolve(appFullPath, entryModule), projectRoot)),
mainPath: join(appFullPath, entryModule),
tsConfigPath: join(__dirname, tsConfigName),
skipCodeGeneration: !aot,
sourceMap: !!isAnySourceMapEnabled,
additionalLazyModuleResources: additionalLazyModuleResources
});
let sourceMapFilename = nsWebpack.getSourceMapFilename(hiddenSourceMap, __dirname, dist);
const itemsToClean = [`${dist}/**/*`];
if (platform === "android") {
itemsToClean.push(`${join(projectRoot, "platforms", "android", "app", "src", "main", "assets", "snapshots")}`);
itemsToClean.push(`${join(projectRoot, "platforms", "android", "app", "build", "configurations", "nativescript-android-snapshot")}`);
}
nsWebpack.processAppComponents(appComponents, platform);
const config = {
mode: production ? "production" : "development",
context: appFullPath,
externals,
watchOptions: {
ignored: [
appResourcesFullPath,
// Don't watch hidden files
"**/.*",
]
},
target: nativescriptTarget,
entry: entries,
output: {
pathinfo: false,
path: dist,
sourceMapFilename,
libraryTarget: "commonjs2",
filename: "[name].js",
globalObject: "global",
hashSalt
},
resolve: {
extensions: [".ts", ".js", ".scss", ".css"],
// Resolve {N} system modules from tns-core-modules
modules: [
resolve(__dirname, "node_modules/tns-core-modules"),
resolve(__dirname, "node_modules"),
"node_modules/tns-core-modules",
"node_modules",
],
alias: {
'~': appFullPath
},
symlinks: true
},
resolveLoader: {
symlinks: false
},
node: {
// Disable node shims that conflict with NativeScript
"http": false,
"timers": false,
"setImmediate": false,
"fs": "empty",
"__dirname": false,
},
devtool: 'none',
optimization: {
runtimeChunk: "single",
splitChunks: {
cacheGroups: {
vendor: {
name: "vendor",
chunks: "all",
test: (module, chunks) => {
const moduleName = module.nameForCondition ? module.nameForCondition() : '';
return /[\\/]node_modules[\\/]/.test(moduleName) ||
appComponents.some(comp => comp === moduleName);
},
enforce: true,
},
}
},
minimize: !!uglify,
minimizer: [
new TerserPlugin({
parallel: true,
cache: true,
sourceMap: isAnySourceMapEnabled,
terserOptions: {
output: {
comments: false,
semicolons: !isAnySourceMapEnabled
},
compress: {
// The Android SBG has problems parsing the output
// when these options are enabled
'collapse_vars': platform !== "android",
sequences: platform !== "android",
}
}
})
],
},
module: {
rules: [
{
include: join(appFullPath, entryPath),
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: {
angular: true,
loadCss: !snapshot, // load the application css if in debug mode
unitTesting,
appFullPath,
projectRoot,
ignoredFiles: nsWebpack.getUserDefinedEntries(entries, platform)
}
},
].filter(loader => !!loader)
},
{ test: /\.html$|\.xml$/, use: "raw-loader" },
// tns-core-modules reads the app.css and its imports using css-loader
{
test: /[\/|\\]app\.css$/,
use: [
"nativescript-dev-webpack/style-hot-loader",
{ loader: "css-loader", options: { url: false } }
]
},
{
test: /[\/|\\]app\.scss$/,
use: [
"nativescript-dev-webpack/style-hot-loader",
{ loader: "css-loader", options: { url: false } },
"sass-loader"
]
},
// Angular components reference css files and their imports using raw-loader
{ test: /\.css$/, exclude: /[\/|\\]app\.css$/, use: "raw-loader" },
{ test: /\.scss$/, exclude: /[\/|\\]app\.scss$/, use: ["raw-loader", "resolve-url-loader", "sass-loader"] },
{
test: /(?:\.ngfactory\.js|\.ngstyle\.js|\.ts)$/,
use: [
"nativescript-dev-webpack/moduleid-compat-loader",
"nativescript-dev-webpack/lazy-ngmodule-hot-loader",
"@ngtools/webpack",
]
},
// Mark files inside `@angular/core` as using SystemJS style dynamic imports.
// Removing this will cause deprecation warnings to appear.
{
test: /[\/\\]@angular[\/\\]core[\/\\].+\.js$/,
parser: { system: true },
},
],
},
plugins: [
// Define useful constants like TNS_WEBPACK
new webpack.DefinePlugin({
"global.TNS_WEBPACK": "true",
"process": "global.process",
}),
// Remove all files from the out dir.
new CleanWebpackPlugin(itemsToClean, { verbose: !!verbose }),
// Copy assets to out dir. Add your own globs as needed.
new CopyWebpackPlugin([
{ from: { glob: "fonts/**" } },
{ from: { glob: "**/*.jpg" } },
{ from: { glob: "**/*.png" } },
{ from: { glob: "assets/css/*.css"}},
], { ignore: [`${relative(appPath, appResourcesFullPath)}/**`] }),
new nsWebpack.GenerateNativeScriptEntryPointsPlugin("bundle"),
// For instructions on how to set up workers with webpack
// check out https://github.com/nativescript/worker-loader
new NativeScriptWorkerPlugin(),
ngCompilerPlugin,
// Does IPC communication with the {N} CLI to notify events when running in watch mode.
new nsWebpack.WatchStateLoggerPlugin(),
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
],
};
if (report) {
// Generate report files for bundles content
config.plugins.push(new BundleAnalyzerPlugin({
analyzerMode: "static",
openAnalyzer: false,
generateStatsFile: true,
reportFilename: resolve(projectRoot, "report", `report.html`),
statsFilename: resolve(projectRoot, "report", `stats.json`),
}));
}
if (snapshot) {
config.plugins.push(new nsWebpack.NativeScriptSnapshotPlugin({
chunk: "vendor",
angular: true,
requireModules: [
"reflect-metadata",
"@angular/platform-browser",
"@angular/core",
"@angular/common",
"@angular/router",
"nativescript-angular/platform-static",
"nativescript-angular/router",
],
projectRoot,
webpackConfig: config,
}));
}
if (hmr) {
config.plugins.push(new webpack.HotModuleReplacementPlugin());
}
return config;
};
package.json
"author": "California Superior Court",
"readme": "California Court Access App",
"repository": "
"scripts": {
"android": "tns run android --clean --bundle --env.uglify --env.hmr",
"build-all": "run-p build-android build-ios",
"build-android": "tns build android --clean --bundle --env.uglify --env.aot --env.snapshot --env.production",
"build-ios": "tns build ios --clean --bundle --env.uglify --env.aot --env.production",
"clean": "yarn cleanjs && yarn cleancss && yarn cleanns",
"cleancss": "find app -name \".css\" ! -name \"fontawesome-all.css\" -type f -delete",
"cleanjs": "find app -name \".js\" -type f -delete",
"cleanns": "rm -rf platforms/ hooks/ node_modules/",
"ios": "tns run ios --clean --bundle --env.uglify --env.hmr",
"lint": "tslint -c tslint.json 'app/*/.ts'",
"prepare-all": "run-p prepare-android prepare-ios",
"prepare-android": "tns prepare android",
"prepare-ios": "tns prepare ios"
},
"license": "SEE LICENSE IN
"nativescript": {
"id": "gov.ca.courts.accessapp",
"tns-ios": {
"version": "6.1.0"
},
"tns-android": {
"version": "6.1.2"
}
},
"husky": {
"hooks": {
"pre-commit": "yarn run lint"
}
},
"dependencies": {
"@angular/animations": "8.1.0",
"@angular/common": "8.1.0",
"@angular/compiler": "8.1.0",
"@angular/core": "8.1.0",
"@angular/forms": "8.1.0",
"@angular/http": "8.0.0-beta.10",
"@angular/platform-browser": "8.1.0",
"@angular/platform-browser-dynamic": "8.1.0",
"@angular/router": "8.1.0",
"@nstudio/nativescript-checkbox": "^1.0.0",
"@nstudio/nativescript-loading-indicator": "^1.0.0",
"base-64": "0.1.0",
"core-js": "2.6.9",
"jwt-decode": "2.2.0",
"lodash": "4.17.11",
"moment": "2.24.0",
"nativescript-angular": "8.1.0",
"nativescript-clipboard": "1.1.7",
"nativescript-directions": "1.3.1",
"nativescript-fancyalert": "3.0.9",
"nativescript-floatingactionbutton": "5.1.0",
"nativescript-google-analytics": "0.4.4",
"nativescript-iqkeyboardmanager": "1.5.1",
"nativescript-masked-text-field": "4.0.2",
"nativescript-ngx-fonticon": "4.2.1",
"nativescript-ngx-shadow": "6.5.0",
"nativescript-pdf-view": "2.0.1",
"nativescript-phone": "1.4.0",
"nativescript-plugin-firebase": "10.0.0",
"nativescript-ripple": "^2.2.1",
"nativescript-social-share": "1.5.2",
"nativescript-taptic-engine": "2.1.0",
"nativescript-theme-core": "2.0.5",
"nativescript-toasty": "2.0.1",
"nativescript-ui-calendar": "5.0.0",
"nativescript-ui-dataform": "5.0.0",
"nativescript-ui-listview": "7.0.2",
"nativescript-ui-sidedrawer": "7.0.0",
"nativescript-unit-test-runner": "0.7.0",
"nativescript-vibrate": "^2.1.3",
"ngx-moment": "3.4.0",
"ngx-restangular": "5.0.0-rc1",
"promise-retry": "1.1.1",
"reflect-metadata": "0.1.13",
"rxjs": "6.5.2",
"rxjs-compat": "6.5.2",
"tns-core-modules": "~6.1.0",
"zone.js": "0.9.1"
},
"description": "California Court Access App",
"devDependencies": {
"@angular/compiler-cli": "8.1.0",
"@nativescript/schematics": "0.6.0",
"@ngtools/webpack": "8.1.0",
"@types/chai": "4.1.7",
"@types/karma-chai": "0.1.1",
"@types/mocha": "5.2.7",
"@types/node": "12.6.9",
"babel-traverse": "6.26.0",
"babel-types": "6.26.0",
"babylon": "6.18.0",
"chai": "4.2.0",
"codelyzer": "5.1.0",
"husky": "3.0.2",
"jasmine-core": "3.4.0",
"karma": "4.2.0",
"karma-chai": "0.1.0",
"karma-jasmine": "2.0.1",
"karma-mocha": "1.3.0",
"karma-nativescript-launcher": "0.4.0",
"karma-teamcity-reporter": "1.1.0",
"karma-webpack": "4.0.2",
"lazy": "1.0.11",
"mocha": "6.2.0",
"nativescript-dev-webpack": "~1.3.0",
"nativescript-doctor": "1.10.0",
"node-sass": "4.12.0",
"npm-run-all": "4.1.5",
"prettier": "1.18.2",
"tns-platform-declarations": "6.0.5",
"ts-node": "8.3.0",
"tslint": "5.18.0",
"typescript": "3.4.5"
}
```
@dcarrot2,
The fail is caused by the JavaScript execution error::
JavaScript execution error: TypeError: t.registerModule is not a function
at /Users/ddiaz/workspace/calcourtapp/platforms/android/app/src/main/assets/app/_embedded_script_.js:37:2194316
You could start the investigation from this line and check what is t and why registerModule is undefined. Most probably t is something Native and you have to wrap it in a function instead of accessing it in the global scope.
@DimitarTachev
Thanks for the pointer! I turned off uglification, and the trace pointed to
module.exports = function() {
loadCss(function() {
global.registerModule("./app.css", () => __webpack_require__(362));
global.registerModule("app.css", () => __webpack_require__(362));
});
}
under the _embedded_script_.js file output from webpack. Looks like this code comes from nativescript-webpack-cli. Might be worth pointing that we're not explicitly loading css files in our app other than a sass-loader via our webpack config.
@dcarrot2
In Angular apps, global.registerModule is defined when you import nativescript-angular/platform which is required to be imported at the beginning of your entry file (e.g. main.ts). Here's an example of properly configured main.ts.
If you have the above-mentioned import as the first row in your main.ts, I suggest you try to reproduce the error in a sample app and attach it to a new issue in order to allow us to investigate it further.
@DimitarTachev
Thanks for the insight. Our main.ts matches the linked example. We ended up upgrading our angular namespace packages and that fixed it. I tried to reproduce the issue on the example template w/o success so my best guess is something introduced in 8.2.1 of angular packages since snapshotting was working for us previously.
Hi @dcarrot2 ,
which version did you use to fix this issue ?
Most helpful comment
Currently, upgrading
nativescript-dev-webpackto the latest version is the only solution.