agibalov / electron-model

http://agibalov.io/electron-model
1 stars 0 forks source link

Enable all the optimizations for prod builds #18

Open agibalov opened 5 years ago

agibalov commented 5 years ago

When I do a prod build with ng build --prod, it complains that:

ERROR in ./src/app/app.component.ngfactory.js
Module not found: Error: Can't resolve '@types/three/three-core' in '/home/aagibalov/electron-model/src/app'
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! electron-model@0.0.0 build_prod: `ng build --prod --base-href http://agibalov.io/electron-model/`

Figure out what happens and enable all the optimizations.

agibalov commented 5 years ago

The easier way to reproduce the issue is to run ng serve --aot=true. It appears that that Angular's AOT mechanism has issues interpreting the 3rd party types. When I do ng build --prod --verbose:

ERROR in ./src/app/app.component.ngfactory.js
Module not found: Error: Can't resolve '@types/three/three-core' in '/home/aagibalov/electron-model/src/app'
resolve '@types/three/three-core' in '/home/aagibalov/electron-model/src/app'
  Parsed request is a module
  using description file: /home/aagibalov/electron-model/package.json (relative path: ./src/app)
    Field 'browser' doesn't contain a valid alias configuration
    resolve as module
      looking for modules in /home/aagibalov/electron-model/
        using description file: /home/aagibalov/electron-model/package.json (relative path: .)
          Field 'browser' doesn't contain a valid alias configuration
          using description file: /home/aagibalov/electron-model/package.json (relative path: ./@types/three/three-core)
            no extension
              Field 'browser' doesn't contain a valid alias configuration
              /home/aagibalov/electron-model/@types/three/three-core doesn't exist
            .ts
              Field 'browser' doesn't contain a valid alias configuration
              /home/aagibalov/electron-model/@types/three/three-core.ts doesn't exist
            .tsx
              Field 'browser' doesn't contain a valid alias configuration
              /home/aagibalov/electron-model/@types/three/three-core.tsx doesn't exist
            .mjs
              Field 'browser' doesn't contain a valid alias configuration
              /home/aagibalov/electron-model/@types/three/three-core.mjs doesn't exist
            .js
              Field 'browser' doesn't contain a valid alias configuration
              /home/aagibalov/electron-model/@types/three/three-core.js doesn't exist
            as directory
              /home/aagibalov/electron-model/@types/three/three-core doesn't exist
      /home/aagibalov/electron-model/src/app/node_modules doesn't exist or is not a directory
      /home/aagibalov/electron-model/src/node_modules doesn't exist or is not a directory
      /home/aagibalov/node_modules doesn't exist or is not a directory
      /home/node_modules doesn't exist or is not a directory
      /node_modules doesn't exist or is not a directory
      looking for modules in /home/aagibalov/electron-model/node_modules
        using description file: /home/aagibalov/electron-model/package.json (relative path: ./node_modules)
          Field 'browser' doesn't contain a valid alias configuration
          using description file: /home/aagibalov/electron-model/node_modules/@types/three/package.json (relative path: ./three-core)
            no extension
              Field 'browser' doesn't contain a valid alias configuration
              /home/aagibalov/electron-model/node_modules/@types/three/three-core doesn't exist
            .ts
              Field 'browser' doesn't contain a valid alias configuration
              /home/aagibalov/electron-model/node_modules/@types/three/three-core.ts doesn't exist
            .tsx
              Field 'browser' doesn't contain a valid alias configuration
              /home/aagibalov/electron-model/node_modules/@types/three/three-core.tsx doesn't exist
            .mjs
              Field 'browser' doesn't contain a valid alias configuration
              /home/aagibalov/electron-model/node_modules/@types/three/three-core.mjs doesn't exist
            .js
              Field 'browser' doesn't contain a valid alias configuration
              /home/aagibalov/electron-model/node_modules/@types/three/three-core.js doesn't exist
            as directory
              /home/aagibalov/electron-model/node_modules/@types/three/three-core doesn't exist
[/home/aagibalov/electron-model/@types/three/three-core]
[/home/aagibalov/electron-model/@types/three/three-core.ts]
[/home/aagibalov/electron-model/@types/three/three-core.tsx]
[/home/aagibalov/electron-model/@types/three/three-core.mjs]
[/home/aagibalov/electron-model/@types/three/three-core.js]
[/home/aagibalov/electron-model/src/app/node_modules]
[/home/aagibalov/electron-model/src/node_modules]
[/home/aagibalov/node_modules]
[/home/node_modules]