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 May 1, 2020. It is now read-only.
The Ionic build process with --prod does not handle packages with require('./package') (as for example in got) right now, but crashes with an error message like this:
Error: ./node_modules/got/index.js
Module not found: Error: Can't resolve './package' in 'C:\Users\Jan\Documents\gotTest\node_modules\got'
resolve './package' in 'C:\Users\Jan\Documents\gotTest\node_modules\got'
using description file: C:\Users\Jan\Documents\gotTest\node_modules\got\package.json (relative path: .)
after using description file: C:\Users\Jan\Documents\gotTest\node_modules\got\package.json (relative path: .)
using description file: C:\Users\Jan\Documents\gotTest\node_modules\got\package.json (relative path: ./package)
no extension
C:\Users\Jan\Documents\gotTest\node_modules\got\package doesn't exist
.js
C:\Users\Jan\Documents\gotTest\node_modules\got\package.js doesn't exist
.ts
C:\Users\Jan\Documents\gotTest\node_modules\got\package.ts doesn't exist
as directory
C:\Users\Jan\Documents\gotTest\node_modules\got\package doesn't exist
[C:\Users\Jan\Documents\gotTest\node_modules\got\package]
[C:\Users\Jan\Documents\gotTest\node_modules\got\package.js]
[C:\Users\Jan\Documents\gotTest\node_modules\got\package.ts]
[C:\Users\Jan\Documents\gotTest\node_modules\got\package]
@ ./node_modules/got/index.js 22:12-32
@ ./src/pages/home/home.js
@ ./src/app/app.module.js
@ ./src/app/app.module.ngfactory.js
@ ./src/app/main.ts
at new BuildError (C:\Users\Jan\Documents\gotTest\node_modules\@ionic\app-scripts\dist\util\errors.js:16:28)
at C:\Users\Jan\Documents\gotTest\node_modules\@ionic\app-scripts\dist\preprocess.js:18:21
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:169:7)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! gotTest@0.0.1 ionic:build: `ionic-app-scripts build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the gotTest@0.0.1 ionic:build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
This should not be a problem at all as a) package seems to be valid instead of package.json and b) app-scripts webpack is already configure to understand this.
Yes indeed, adding .json to that array allows the project to build.
I should have looked at the output a bit better:
...
[09:56:06] deeplinks started ...
[09:56:07] deeplinks finished in 478 ms
[09:56:07] optimization started ...
[09:56:07] copy finished in 16.79 s
[09:56:20] ionic-app-script task: "build"
[09:56:20] Error: ./node_modules/got/index.js Module not found: Error: Can't resolve './package' in
'C:\Users\Jan\Documents\yatsa\node_modules\got' resolve './package' in
'C:\Users\Jan\Documents\yatsa\node_modules\got' using description file:
This was have shown me that the problem was in the "optimization" step, not "webpack".
Short description of the problem:
The Ionic build process with
--prod
does not handle packages withrequire('./package')
(as for example ingot
) right now, but crashes with an error message like this:The suggested workaround is to configure webpack.config.js to include this:
As I understood it this makes webpack look not only for
package
but alsopackage.js
andpackage.json
.Unfortunately this already seems to be included in the default webpack.confis.js of app-scripts:
https://github.com/ionic-team/ionic-app-scripts/blob/master/config/webpack.config.js#L22-L25
What should I do now?
What behavior are you expecting?
This should not be a problem at all as a)
package
seems to be valid instead ofpackage.json
and b) app-scripts webpack is already configure to understand this.Steps to reproduce:
ionic start gotTest blank
npm install got
npm install electron --save-dev
(workaround for [another webpack issue with got}(https://github.com/Usinggot
in a project built with webpack crashes aselectron
is used, but not part ofpackage.json
sindresorhus/got#345), will be fixed with next release)npm run ionic:build --prod
to see the error(Or clone this repo: https://github.com/janpio/ionic-webpack-got-problem where I did exactly that)
Which @ionic/app-scripts version are you using?
2.0.2
Other information:
global packages:
local packages:
System:
The text was updated successfully, but these errors were encountered: