Webpack build doesn't work with mime-db components

Hi, i use ionic rc3 and app-script 0.0.45.

interresting part of package.json :

"scripts": {
"build": "ionic-app-scripts build",
"watch": "ionic-app-scripts watch",
"serve:before": "watch",
"emulate:before": "build",
"deploy:before": "build",
"build:before": "build",
"run:before": "build"
`},
 "dependencies": {
"@angular/common": "2.1.1",
"@angular/compiler": "2.1.1",
"@angular/compiler-cli": "2.1.1",
"@angular/core": "2.1.1",
"@angular/forms": "2.1.1",
"@angular/http": "2.1.1",
"@angular/platform-browser": "2.1.1",
"@angular/platform-browser-dynamic": "2.1.1",
"@angular/platform-server": "2.1.1",
"@ionic/storage": "1.1.6",
"angular2-moment": "^1.0.0-beta.5",
"chart.js": "^2.3.0",
"ionic-angular": "2.0.0-rc.3",
"ionic-native": "^2.2.3",
"ionicons": "^3.0.0",
"mime-types": "^2.1.12",
"moment": "^2.15.1",
"ng2-charts": "^1.4.0",
"ng2-translate": "^3.1.2",
"zone.js": "0.6.26"
 }

During the build, i don’t have problem. But, at runtime i’ve this error (and blankpage in browser) : Uncaught Error: Cannot find module “./db.json”, \node_modules\mime-db\index.js.

In fact, the mime-types do that :
var db = require('mime-db')
And the mime-db do that :
module.exports = require('./db.json')

The db.json is present in mime-db directory…so i don’t understand why the build process doesn’t copy it ?

Any idea ? Thx !

If by any chance you’re using Webpack >= 2.1.0.beta.26, you might be being bit by a bug that is fixed in this commit.

1 Like

@rapropos That helped me, thanks! :slight_smile: