-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Default sourceMap to empty object #107
Conversation
Latest sourceMap option update breaks when we DON'T specific the `--sourcemap` option. That's because we set `browserOptions.sourceMap` to `options.sourceMap` which is null or undefined. Error stacktrace: ``` [ng] Cannot destructure property `styles` of 'undefined' or 'null'. [ng] TypeError: Cannot destructure property `styles` of 'undefined' or 'null'. [ng] at Object.getCommonConfig (/…/node_modules/@angular-devkit/build-angular/src/angular-cli-files/models/webpack-configs/common.js:33:107) [ng] at BrowserBuilder.buildWebpackConfig (/…/node_modules/@angular-devkit/build-angular/src/browser/index.js:81:31) [ng] at CordovaDevServerBuilder.buildWebpackConfig (/…/node_modules/@angular-devkit/build-angular/src/dev-server/index.js:109:46) [ng] at CordovaDevServerBuilder.buildWebpackConfig (/…/node_modules/@ionic/angular-toolkit/builders/cordova-serve/index.js:47:22) [ng] at MergeMapSubscriber.rxjs_1.from.pipe.operators_1.concatMap [as project] (/…/node_modules/@angular-devkit/build-angular/src/dev-server/index.js:36:40) [ng] at MergeMapSubscriber._tryNext (/…/node_modules/rxjs/internal/operators/mergeMap.js:69:27) [ng] at MergeMapSubscriber._next (/…/node_modules/rxjs/internal/operators/mergeMap.js:59:18) [ng] at MergeMapSubscriber.Subscriber.next (/…/node_modules/rxjs/internal/Subscriber.js:67:18) [ng] at TapSubscriber._next (/…/node_modules/rxjs/internal/operators/tap.js:65:26) [ng] at TapSubscriber.Subscriber.next (/…/node_modules/rxjs/internal/Subscriber.js:67:18) [ng] at MergeMapSubscriber.notifyNext (/…/node_modules/rxjs/internal/operators/mergeMap.js:92:26) [ng] at InnerSubscriber._next (/…/node_modules/rxjs/internal/InnerSubscriber.js:28:21) [ng] at InnerSubscriber.Subscriber.next (/…/node_modules/rxjs/internal/Subscriber.js:67:18) [ng] at MergeMapSubscriber.notifyNext (/…/node_modules/rxjs/internal/operators/mergeMap.js:92:26) [ng] at InnerSubscriber._next (/…/node_modules/rxjs/internal/InnerSubscriber.js:28:21) [ng] at InnerSubscriber.Subscriber.next (/…/node_modules/rxjs/internal/Subscriber.js:67:18) ```
That's odd. What are the reproduction steps? The following command works for me:
Additionally, the schema for the browser builder does not list the option as required: https://github.com/angular/angular-cli/blob/2e9dc3d2528e40ab80a20f3c6f0a3433971fc72d/packages/angular_devkit/build_angular/src/browser/schema.json |
I'm running The way I understand it, the problem is we set
|
@joelcogen @carstenbaumhoegger Can I see the configuration in
I'm guessing |
@dwieeb here's my angular.json
|
Interesting. This is actually due to that use of Without the
I also found out something new about object destructuring:
|
I think a proper fix for this would be something similar to the code in your comment. If the However, we need to check if it's truly specified (and not miss the if (typeof options.sourceMap !== 'undefined') {
browserOptions.sourceMap = options.sourceMap;
} |
@dwieeb this is my angular.json: {
"$schema": "./node_modules/@angular-devkit/core/src/workspace/workspace-schema.json",
"version": 1,
"projects": {
"app": {
"root": "",
"projectType": "application",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"progress": false,
"outputPath": "www",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.app.json",
"assets": [
{
"glob": "**/*",
"input": "src/assets",
"output": "assets"
},
{
"glob": "**/*.svg",
"input": "node_modules/ionicons/dist/ionicons/svg",
"output": "./svg"
}
],
"styles": [
{
"input": "src/theme/variables.scss"
},
{
"input": "src/global.scss"
}
],
"scripts": []
},
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true
}
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "app:build"
},
"configurations": {
"production": {
"browserTarget": "app:build:production"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "app:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.spec.json",
"karmaConfig": "src/karma.conf.js",
"styles": [
{
"input": "styles.css"
}
],
"scripts": [],
"assets": [
{
"glob": "favicon.ico",
"input": "src/",
"output": "/"
},
{
"glob": "**/*",
"input": "src/assets",
"output": "/assets"
}
]
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"src/tsconfig.app.json",
"src/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
}
},
"ionic-cordova-build": {
"builder": "@ionic/angular-toolkit:cordova-build",
"options": {
"browserTarget": "app:build"
},
"configurations": {
"production": {
"browserTarget": "app:build:production"
}
}
},
"ionic-cordova-serve": {
"builder": "@ionic/angular-toolkit:cordova-serve",
"options": {
"cordovaBuildTarget": "app:ionic-cordova-build",
"devServerTarget": "app:serve"
},
"configurations": {
"production": {
"cordovaBuildTarget": "app:ionic-cordova-build:production",
"devServerTarget": "app:serve:production"
}
}
}
}
},
"app-e2e": {
"root": "e2e/",
"projectType": "application",
"architect": {
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "e2e/protractor.conf.js",
"devServerTarget": "app:serve",
"port": 4202
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": "e2e/tsconfig.e2e.json",
"exclude": [
"**/node_modules/**"
]
}
}
}
}
},
"cli": {
"defaultCollection": "@ionic/schematics-angular"
},
"schematics": {
"@ionic/schematics-angular:component": {
"styleext": "scss"
},
"@ionic/schematics-angular:page": {
"styleext": "scss"
}
},
"defaultProject": "app"
} |
@joelcogen Thoughts on my comment? |
Maybe ?
|
@dwieeb Updated accordingly, wdyt? |
I guess you mean |
"ionic-cordova-build": {
"builder": "@ionic/angular-toolkit:cordova-build",
"options": {
"browserTarget": "app:build",
"sourceMap": null
}, Its type is correct ( We're just incorrectly coercing it to I think the linter doesn't like the |
I guess this change is enough then? |
I think so! I'll get this merged in and released. |
## [1.5.1](v1.5.0...v1.5.1) (2019-04-09) ### Bug Fixes * **cordova-build:** only set sourceMap if specified ([#107](#107)) ([2a99ac0](2a99ac0))
🎉 This PR is included in version 1.5.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
## [1.5.1](ionic-team/angular-toolkit@v1.5.0...v1.5.1) (2019-04-09) ### Bug Fixes * **cordova-build:** only set sourceMap if specified ([#107](ionic-team/angular-toolkit#107)) ([2a99ac0](ionic-team/angular-toolkit@2a99ac0))
Latest sourceMap option update breaks when we DON'T specific the
--sourcemap
option.That's because we set
browserOptions.sourceMap
tooptions.sourceMap
which is null or undefined.Error stacktrace:
Fixes #109