Skip to content
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

Custom-webpack does not respect "sourceMap": { "hidden": true } #308

Closed
yadue opened this issue Apr 29, 2019 · 8 comments
Closed

Custom-webpack does not respect "sourceMap": { "hidden": true } #308

yadue opened this issue Apr 29, 2019 · 8 comments

Comments

@yadue
Copy link

yadue commented Apr 29, 2019

Describe the bug
When setting:
"sourceMap": {
"scripts": true,
"hidden": true
},

build still appends sourcePaths to js files.

To Reproduce
Steps to reproduce the behavior:
Add "sourceMap": {
"scripts": true,
"hidden": true
},
Expected behavior
The sourcemap path should not be visible

Screenshots
Zrzut ekranu 2019-04-29 o 22 42 56

Builder:
@angular-builders/custom-webpack:browser
7.4.3

@just-jeb
Copy link
Owner

just-jeb commented Apr 30, 2019

Webpack setting that is responsible for source maps called devtool, not sourceMap. Am I missing something?

@yadue
Copy link
Author

yadue commented Apr 30, 2019

This is from architect.build.staging in angular.json. Custom-webpack ignorews that setting
Zrzut ekranu 2019-04-30 o 10 01 12

@just-jeb
Copy link
Owner

Which version of Angular you're on? If you use plain @angular-devkit/build-angular:browser everything works as expected? Could you please share you custom webpack configuration?

@yadue
Copy link
Author

yadue commented Apr 30, 2019

[email protected]

webpack config:

var webpack = require('webpack');

module.exports = {
    // issue: https://github.com/angular/angular-cli/issues/1548
    // explanation: https://github.com/angular/angular-cli/issues/1548#issuecomment-286151056
    // workaround: https://github.com/angular/angular-cli/issues/1548#issuecomment-427653778
    node: {
        http: true,
        https: true,
        global: true,
    },
    devServer: {
        http2: false
    }
}

Im unable to use regular angular build thats why Im using custom webpack

@just-jeb
Copy link
Owner

Would you mind sharing the whole angular.json config + the way you're running the build?

@yadue
Copy link
Author

yadue commented Apr 30, 2019

"build-staging": "ng build --configuration staging --base-href /proof/ --progress true --sourceMap --prod",

just add sourceMap config I sent previosly

@yadue
Copy link
Author

yadue commented Apr 30, 2019

{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "version": 1,
  "newProjectRoot": "projects",
  "projects": {
    "company-app-name": {
      "root": "",
      "sourceRoot": "src",
      "projectType": "application",
      "architect": {
        "build": {
          "builder": "@angular-builders/custom-webpack:browser",
          "options": {
            "customWebpackConfig": {
              "path": "./webpack.config.js"
            },
            "outputPath": "public/app-name/",
            "index": "src/index.html",
            "main": "src/main.ts",
            "deployUrl": "/app-name/",
            "tsConfig": "src/tsconfig.app.json",
            "preserveSymlinks": true,
            "showCircularDependencies": false,
            "polyfills": "src/polyfills.ts",
            "assets": [
              "src/assets",
              "src/favicon.ico"
            ],
            "styles": [
              "src/assets/styles/main.scss"
            ],
            "scripts": []
          },
          "configurations": {
            "dev": {
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.dev.ts"
                }
              ]
            },
            "staging": {
              "optimization": false,
              "outputHashing": "all",
              "sourceMap": {
                "scripts": true,
                "hidden": true
              },
              "extractCss": true,
              "namedChunks": false,
              "aot": true,
              "extractLicenses": true,
              "vendorChunk": false,
              "buildOptimizer": false,
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.staging.ts"
                }
              ]
            },
            "pre-prod": {
              "optimization": true,
              "outputHashing": "all",
              "sourceMap": false,
              "extractCss": true,
              "namedChunks": false,
              "aot": true,
              "extractLicenses": true,
              "vendorChunk": false,
              "buildOptimizer": true,
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.pre-prod.ts"
                }
              ]
            },
            "prod": {
              "optimization": true,
              "outputHashing": "all",
              "sourceMap": false,
              "extractCss": true,
              "namedChunks": false,
              "aot": true,
              "extractLicenses": true,
              "vendorChunk": false,
              "buildOptimizer": true,
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.prod.ts"
                }
              ]
            }
          }
        },
        "serve": {
          "builder": "@angular-builders/dev-server:generic",
          "options": {
            "browserTarget": "company-app-name:build"
          },
          "configurations": {
            "dev": {
              "browserTarget": "company-app-name:build:dev"
            },
            "staging": {
              "browserTarget": "company-app-name:build:staging"
            },
            "pre-prod": {
              "browserTarget": "company-app-name:build:pre-prod"
            },
            "prod": {
              "browserTarget": "company-app-name:build:production"
            }
          }
        },
        "extract-i18n": {
          "builder": "@angular-devkit/build-angular:extract-i18n",
          "options": {
            "browserTarget": "company-app-name:build"
          }
        },
        "test": {
          "builder": "@angular-devkit/build-angular:karma",
          "options": {
            "main": "src/test.ts",
            "karmaConfig": "./karma.conf.js",
            "polyfills": "src/polyfills.ts",
            "tsConfig": "src/tsconfig.spec.json",
            "scripts": [],
            "styles": [
              "src/assets/styles/main.scss"
            ],
            "assets": [
              "src/assets",
              "src/favicon.ico"
            ]
          }
        },
        "lint": {
          "builder": "@angular-devkit/build-angular:tslint",
          "options": {
            "tsConfig": [
              "src/tsconfig.app.json",
              "src/tsconfig.spec.json"
            ],
            "exclude": [
              "**/node_modules/**/*"
            ]
          }
        }
      }
    },
    "company-app-name-e2e": {
      "root": "e2e",
      "sourceRoot": "e2e",
      "projectType": "application",
      "architect": {
        "e2e": {
          "builder": "@angular-devkit/build-angular:protractor",
          "options": {
            "protractorConfig": "./protractor.conf.js",
            "devServerTarget": "company-app-name:serve"
          }
        },
        "lint": {
          "builder": "@angular-devkit/build-angular:tslint",
          "options": {
            "tsConfig": [
              "e2e/tsconfig.e2e.json"
            ],
            "exclude": [
              "**/node_modules/**/*"
            ]
          }
        }
      }
    }
  },
  "defaultProject": "company-app-name",
  "schematics": {
    "@schematics/angular:component": {
      "prefix": "",
      "styleext": "scss"
    },
    "@schematics/angular:directive": {
      "prefix": "",
      "styleext": "scss"
    }
  }
}

@yadue
Copy link
Author

yadue commented Apr 30, 2019

Okay I see my mistake, running with --sourceMap overwrote setting.

@yadue yadue closed this as completed Apr 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants