Parcel: Enable/disable node-sass sourcemaps

Created on 27 Feb 2018  路  9Comments  路  Source: parcel-bundler/parcel

馃憢

Is there a way to add sourcemaps support for node-sass ?

Only way i've found is to create a .sassrc with this config (inline-sourcemaps here) for example:

{
  "sourceMap": true,
  "sourceMapEmbed": true
}

But no way to disable it when running parcel buildcommand.

Thanks for your work.

Help Wanted Feature CSS Preprocessing

Most helpful comment

I've opened a PR to implement this feature: https://github.com/parcel-bundler/parcel/pull/1373

Note that sass test are failing for now, and I don't really understand why.
If someone with a deeper understanding of the Parcel code base than me could take a look and see what's wrong, this would help me a lot !

All 9 comments

This is really a feature request for CSS source maps. We should enable/disable them based on the CLI flag for sourcemaps that is already used for JS.

@devongovett hey is cli flags still available to disable then sourcemap?
I just installed the latest 1.6.2 version and found it shows unknown option: --no-source-maps when trying to disable it.

screen shot 2018-02-28 at 19 33 30

// package.json
...
"scripts": {
    "start": "parcel index.html --open",
    "build": "parcel build index.html --no-source-maps"
  },
"devDependencies": {
    "parcel-bundler": "^1.6.2",
    "typescript": "^2.7.2"
  },
  "dependencies": {
    "react": "^16.2.0",
    "react-dom": "^16.2.0"
  }
...

both local and global are 1.6.2 version.

there is also no such option in help infos when I typed parce build -h in terminal, other flag works well tho.
screen shot 2018-02-28 at 19 32 12

@shadeofgod the build sourcemaps haven't been released yet, they are only on the current master branch of the github repo

@DeMoorJasper this is a little bit weird, it do generated sourcemaps at the first time when I ran build command, later after I posted here I removed whole local node_modules directory and npm install everything again, oops no more sourcemaps for the build this time.

btw docs says it was enabled by default tho.

@shadeofgod The docs is my bad, it should've said is enabled by default in watch mode, as it's not been released yet on build as I said before.
In the next release it will however be enabled by default in production, the sourcemaps inside your output folder is probably from the watch command? As they probably use the same output directory, otherwise this would be very weird or u were using the github version.

@DeMoorJasper yeah you are right, I found it. It was generated by that npm start command. And build command won't remove all the files at first in dist/ directory(seems it simply replaces content with same file name) and the sourcemaps file just stays there all the time so I thought it was from production mode.

thanks for your quick response!

I've opened a PR to implement this feature: https://github.com/parcel-bundler/parcel/pull/1373

Note that sass test are failing for now, and I don't really understand why.
If someone with a deeper understanding of the Parcel code base than me could take a look and see what's wrong, this would help me a lot !

Sass source maps are not working for me.
I have created a .sassrc file with the proper config, but I get to source mapping whatsoever.

PR coming along for this in #2489

Was this page helpful?
0 / 5 - 0 ratings

Related issues

davidnagli picture davidnagli  路  3Comments

medhatdawoud picture medhatdawoud  路  3Comments

davidnagli picture davidnagli  路  3Comments

will-stone picture will-stone  路  3Comments

donaldallen picture donaldallen  路  3Comments