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

CSS Sourcemap is always empty #4199

Closed
changLiuUNSW opened this issue Jan 24, 2017 · 16 comments
Closed

CSS Sourcemap is always empty #4199

changLiuUNSW opened this issue Jan 24, 2017 · 16 comments
Labels
P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent type: bug/fix

Comments

@changLiuUNSW
Copy link
Contributor

changLiuUNSW commented Jan 24, 2017

My Angular-Cli version is 1.0.0-beta.26
Here is my angular-cli.json:

{
  "project": {
    "version": "1.0.0-beta.26",
    "name": "test"
  },
  "apps": [
    {
      "root": "src",
      "outDir": "dist",
      "assets": [
        "assets",
        "favicon.ico"
      ],
      "index": "index.html",
      "main": "main.ts",
      "test": "test.ts",
      "tsconfig": "tsconfig.json",
      "prefix": "app",
      "mobile": false,
      "styles": [
        "styles.scss"
      ],
      "scripts": [],
      "environments": {
        "source": "environments/environment.ts",
        "dev": "environments/environment.ts",
        "prod": "environments/environment.prod.ts"
      }
    }
  ],
  "e2e": {
    "protractor": {
      "config": "./protractor.conf.js"
    }
  },
  "test": {
    "karma": {
      "config": "./karma.conf.js"
    }
  },
  "defaults": {
    "styleExt": "scss",
    "prefixInterfaces": false,
    "inline": {
      "style": false,
      "template": false
    },
    "spec": {
      "class": false,
      "component": true,
      "directive": true,
      "module": false,
      "pipe": true,
      "service": true
    }
  }
}

And Here is my styles.scss

h1 {
    font-size: 20px;
}

When I type ng serve --extract-css=true or ng build --extract-css=true, the styles.bundle.map is always empty like:

{"version":3,"sources":[],"names":[],"mappings":"","file":"styles.bundle.css","sourceRoot":""}

Does anyone have the same issue with me ? Or maybe this is expected behavior ?

@changLiuUNSW
Copy link
Contributor Author

I also tried ng serve --extract-css=true --sourcemap=true or ng build --extract-css=true --sourcemap=true, the result is still the same.

@filipesilva
Copy link
Contributor

Bug I think. I have known about it for a while, but haven't had time to look at it yet.

@filipesilva filipesilva added command: build P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent type: bug/fix labels Jan 24, 2017
@changLiuUNSW
Copy link
Contributor Author

changLiuUNSW commented Jan 24, 2017

I think we should have e2e test to cover css sourcemap

@a5hik
Copy link

a5hik commented Jan 25, 2017

I'm facing the same issue, the css source map is empty.

@filipesilva
Copy link
Contributor

Dupe of #2020, fixed by #4222.

@applemate
Copy link

Are you sure it's fixed? I still have the issue. My command is like this

"start": "ng serve --port 1800 --extract-css=true --sourcemap=true",

And source map still not show up

screen_shot_2017-02-15_at_11_04_08_pm

demo: https://github.com/craigcosmo/yeahman-angular-cli-app

@changLiuUNSW
Copy link
Contributor Author

@filipesilva Maybe we need to reopen this issue

@filipesilva
Copy link
Contributor

Regarding component styles and sourcemaps, please see @asnowwolf's excelent explanation in #3617 (comment).

The gist of it is that component styles atm cannot have style maps.

@changLiuUNSW
Copy link
Contributor Author

The sourcemaps for global style seemed broken again

@filipesilva
Copy link
Contributor

@changLiuUNSW can you show me a repro?

@changLiuUNSW
Copy link
Contributor Author

changLiuUNSW commented Feb 20, 2017

@filipesilva https://github.com/changLiuUNSW/ng2Redux based on angular-cli 1.0.0-beta.32.3

@filipesilva
Copy link
Contributor

@changLiuUNSW I tried your repo, serving with ng serve --extract-css, and I could see the sourcemaps for scss files:

image

@changLiuUNSW
Copy link
Contributor Author

Yes, it works. I forget to put --extract-css
Thanks @filipesilva

@daddyschmack
Copy link

daddyschmack commented Jun 29, 2017

@filipesilva , HI, this is not working for me in v1.04. What steps do I need to troubleshoot? Or what do you need from me to troubleshoot?
I've tried:
ng serve -prod
I've tried :
ng serve --extract-css -sourcemap=true

My expectation is to see the component scss files mapped to the elements inspected in chrome developer tools. Please let me know if this is not the correct expectation.
BTW, TS source maps are working.

image

@asnowwolf
Copy link

asnowwolf commented Jun 29, 2017

@daddyschmack It's a reasonable expectation. But in fact, this issue is blocked by angular/angular#16088 and angular/angular#16090 .
In other words, currently, it's an issue of "angular", not "angular-cli"'s. You can go to vote to push them to be merged.
I've resolved the part of cli through a pull request to css-loader webpack-contrib/css-loader#417 . So, just waiting for the angular repo.

asnowwolf pushed a commit to asnowwolf/angular that referenced this issue Aug 15, 2017
Fix CSS source mapping for component by keeping `/*# sourceMappingURL= ... */` and  `/*# sourceURL= ... */` comments.

See <angular/angular-cli#4199>
asnowwolf pushed a commit to asnowwolf/angular that referenced this issue Aug 15, 2017
Fix CSS source mapping for component by keeping `/*# sourceMappingURL= ... */` and  `/*# sourceURL= ... */` comments.

Relates to <angular/angular-cli#4199>.
hansl pushed a commit to angular/angular that referenced this issue Aug 15, 2017
Fix CSS source mapping for component by keeping `/*# sourceMappingURL= ... */` and  `/*# sourceURL= ... */` comments.

Relates to <angular/angular-cli#4199>.
juleskremer pushed a commit to juleskremer/angular that referenced this issue Aug 26, 2017
Fix CSS source mapping for component by keeping `/*# sourceMappingURL= ... */` and  `/*# sourceURL= ... */` comments.

Relates to <angular/angular-cli#4199>.
juleskremer pushed a commit to juleskremer/angular that referenced this issue Aug 28, 2017
Fix CSS source mapping for component by keeping `/*# sourceMappingURL= ... */` and  `/*# sourceURL= ... */` comments.

Relates to <angular/angular-cli#4199>.
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent type: bug/fix
Projects
None yet
Development

No branches or pull requests

6 participants