ionic-team / ionic-app-scripts

App Build Scripts for Ionic Projects
http://ionicframework.com/
MIT License
609 stars 300 forks source link

TypeError: Cannot read property 'moduleType' of undefinded when build --prod #1528

Open prakasa-tkpd opened 5 years ago

prakasa-tkpd commented 5 years ago

Note: for support questions, please use one of these channels:

https://forum.ionicframework.com/ http://ionicworldwide.herokuapp.com/

Short description of the problem:

Error when exec build --prod

What behavior are you expecting?

Running normal

Steps to reproduce:

  1. ionic-app-scripts build --prod
  2. open apps
  3. error TypeError: Cannot read property 'moduleType' of undefinded

main.ts

const debug = require('debug')('devetek:hompes');

import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from '@app/app.module';
import { enableProdMode } from '@angular/core';
import { NODE_ENV } from '@constants/index';

if (NODE_ENV) {
  enableProdMode();
}

document.addEventListener('DOMContentLoaded', () => {
  platformBrowserDynamic().bootstrapModule(AppModule)
    .catch(err => debug(err));
});

Which @ionic/app-scripts version are you using? npm run-script build --prod

Other information: (e.g. stacktraces, related issues, suggestions how to fix, stackoverflow links, forum links, etc) Its running well when exec ionic-app-scripts serve

error on build prod:

Cannot read property 'moduleType' of undefined
TypeError: Cannot read property 'moduleType' of undefined
    at http://localhost/build/vendor.js:1:38866
    at t.invoke (http://localhost/build/polyfills.js:3:14976)
    at Object.onInvoke (http://localhost/build/vendor.js:1:34734)
    at t.invoke (http://localhost/build/polyfills.js:3:14916)
    at r.run (http://localhost/build/polyfills.js:3:10143)
    at t.run (http://localhost/build/vendor.js:1:35456)
    at t.bootstrapModuleFactory (http://localhost/build/vendor.js:1:38797)
    at HTMLDocument.<anonymous> (http://localhost/build/main.js:1:373)