Build does not work with prod mode

Hello,

I become desperate because I do not understand why it not works for me.
I make the same as described here https://github.com/gshigeto/ionic-environment-variables.
I have two environment variables prod and dev as above.

I execute the command…
cordova build ios --prod
But everytime the environment.dev.ts was taken.
Has anybody any idea?

Ionic cordova build ios --pro

Is the cli command to use if ypu want to rely on ionic stuff

1 Like

ok… thanks… my mistake…
I try it now, got this error

Error: Metadata version mismatch for module xxx/node_modules/ionic-img-viewer/dist/es2015/sr
c/module.d.ts, found version 4, expected 3
    at StaticSymbolResolver.getModuleMetadata (xxx\node_modules\@angular\compiler\bundles\co
mpiler.umd.js:24474:34)
    at StaticSymbolResolver._createSymbolsOf (xxx\node_modules\@angular\compiler\bundles\com
piler.umd.js:24260:46)
    at StaticSymbolResolver.getSymbolsOf (xxx\node_modules\@angular\compiler\bundles\compile
r.umd.js:24241:14)
    at xxx\node_modules\@angular\compiler\bundles\compiler.umd.js:23023:30
    at Array.forEach (native)
    at extractProgramSymbols (xxx\node_modules\@angular\compiler\bundles\compiler.umd.js:230
22:79)
    at AotCompiler.compileAll (xxx\node_modules\@angular\compiler\bundles\compiler.umd.js:22
720:47)
    at CodeGenerator.codegen (xxx\node_modules\@angular\compiler-cli\src\codegen.js:30:14)
    at Function.NgTools_InternalApi_NG_2.codeGen (xxx\node_modules\@angular\compiler-cli\src
\ngtools_api.js:61:30)
    at Object.doCodegen (xxx\node_modules\@ionic\app-scripts\dist\aot\codegen.js:6:51)

I made a step forward and get now the error
With Ionic cordova build ios --dev it works.

 ionic-app-script task: "build"
 Error: ./src/pages/hello.component.js Module not found: Error: Can't resolve '@app/env' in
 'xxx\src\pages' resolve '@app/env' in
 'xxx\src\pages' Parsed request is a module using description file:
 xxx\package.json (relative path: ./src/pages) Field 'browser' doesn't
 contain a valid alias configuration after using description file:
 xxx\package.json (relative path: ./src/pages) resolve as module
 xxx\src\pages\node_modules doesn't exist or is not a directory
 xxx\src\pages\node_modules doesn't exist or is not a directory
 xxx\src\node_modules doesn't exist or is not a directory xxx\node_modules
 doesn't exist or is not a directory xxx\node_modules doesn't exist or is not a directory looking for modules

 in xxx\node_modules using description file:
 xxx\package.json (relative path: ./node_modules) Field 'browser' doesn't contain

 a valid alias configuration after using description file: xxx\package.json
 (relative path: ./node_modules) using description file: xxx\package.json
 (relative path: ./node_modules/@app/env) no extension Field 'browser' doesn't contain a valid alias
 configuration xxx\node_modules\@app\env doesn't exist .js Field 'browser'
 doesn't contain a valid alias configuration xxx\node_modules\@app\env.js doesn't

Hi

no clue… check your dependencies and go see the doctor?

Try a new project and get it to work?

Run ionic build --prod to check if it is the web part or the cordova part?

Tom

works now, fault dependencies…

I’m facing the same problem but I didn’t found a solution… How have you done?
Thanks
Luigi

1 Like