Gabriel Milioli
Gabriel Milioli

Reputation: 11

Building not working ionic 3 - webpack error

I'm facing an error since I've updated ionic-app-scripts to the last version.

I run the command :

ionic cordova build android --prod --release 

and I get this error after webpack started :

[09:45:20]  ionic-app-script task: "build"
[09:45:20]  TypeError: Cannot read property 'compilation' of undefined
TypeError: Cannot read property 'compilation' of undefined
    at DefinePlugin.apply (C:\Users\gabi\Desktop\git\tcc\node_modules\webpack\lib\DefinePlugin.js:93:18)
    at Compiler.apply (C:\Users\gabi\Desktop\git\tcc\node_modules\@ionic\app-scripts\node_modules\tapable\lib\Tapable.js:375:16)
    at webpack (C:\Users\gabi\Desktop\git\tcc\node_modules\@ionic\app-scripts\node_modules\webpack\lib\webpack.js:33:19)
    at C:\Users\gabi\Desktop\git\tcc\node_modules\@ionic\app-scripts\dist\webpack.js:132:24
    at new Promise (<anonymous>)
    at runWebpackFullBuild (C:\Users\gabi\Desktop\git\tcc\node_modules\@ionic\app-scripts\dist\webpack.js:113:12)
    at webpackWorker (C:\Users\gabi\Desktop\git\tcc\node_modules\@ionic\app-scripts\dist\webpack.js:70:19)
    at Object.webpack (C:\Users\gabi\Desktop\git\tcc\node_modules\@ionic\app-scripts\dist\webpack.js:29:12)
    at bundleWorker (C:\Users\gabi\Desktop\git\tcc\node_modules\@ionic\app-scripts\dist\bundle.js:13:22)
    at Object.bundle (C:\Users\gabi\Desktop\git\tcc\node_modules\@ionic\app-scripts\dist\bundle.js:6:12)
[ERROR] An error occurred while running subprocess ionic-app-scripts.

My Ionic info:

Ionic:

ionic (Ionic CLI)  : 4.1.2 (C:\Users\gabi\AppData\Roaming\npm\node_modules\ionic)
   Ionic Framework    : ionic-angular 3.9.2
   @ionic/app-scripts : 3.2.0

Cordova:

   cordova (Cordova CLI) : 8.0.0
   Cordova Platforms     : android 7.0.0, browser 5.0.4, ios 4.5.5
   Cordova Plugins       : cordova-plugin-ionic-keyboard 2.1.2, cordova-plugin-ionic-webview 2.0.2, (and 12 other plugins)

System:`enter code here`

   NodeJS : v8.11.3 (C:\Program Files\nodejs\node.exe)
   npm    : 6.2.0
   OS     : Windows 10

I tried downgrading ionic-app-scripts, but no success .

Upvotes: 1

Views: 1215

Answers (2)

Ashu Singh
Ashu Singh

Reputation: 341

I downgraded my webpack version to 3.12.0 and it worked;

npm install [email protected]

Upvotes: 1

Fede Figueroa
Fede Figueroa

Reputation: 1

I was trying to add webpack, karma and jasmine to an ionic 3 app and after all the configurations the console gave me the same error. I solved it using the @ionic/app-scripts 3.1.11.

BTW: To include and implement succefully webpack karma etc, I had to downgrade the npm and the Ionic CLI versions too, but maybe it's unnecesary.

Ionic: @ionic/cli-utils : 1.19.2 ionic (Ionic CLI) : 3.20.0

local packages:

@ionic/app-scripts : 3.1.11
Ionic Framework    : ionic-angular 3.9.2

System:

Node : v9.8.0
npm  : 5.6.0
OS   : Linux 4.15

Upvotes: 0

Related Questions