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

PostCSS PreviousMap missing #3955

Open
SassNinja opened this issue Jan 3, 2020 · 0 comments
Open

PostCSS PreviousMap missing #3955

SassNinja opened this issue Jan 3, 2020 · 0 comments
Labels
CSS Preprocessing All the PostCSS, Less, SASS, etc issues 🙋‍♀️ Feature

Comments

@SassNinja
Copy link

🐛 bug report

I expect to have access to the source map (PreviousMap) within my PostCSS plugin (similar to webpack)

module.exports = postcss.plugin('postcss-extract-media-query', opts => {
  return (root, result) => {
    // expect root.source.input.map to contain the PreviousMap
  };
});

🎛 Configuration (.babelrc, package.json, cli command)

package.json

"devDependencies": {
  "parcel-bundler": "^1.12.4",
  "parcel-plugin-nuke-dist": "^1.0.1",
  "postcss-extract-media-query": "2.x",
  "sass": "^1.24.0"
}

parcel.js

const parcel = require('parcel-bundler');
const path = require('path');
const file = path.join(__dirname, 'src/example.js');
const options = {
  watch: false,
  sourceMaps: true,
  cache: false
};
const bundler = new parcel(file, options);
bundler.bundle();

🤔 Expected Behavior

root.source.input.map should contain the PreviousMap so I expect

root: {
  source: {
    input: {
      css: ".foo {\n color: red...",
      file: "/Users/...",
      from: "/Users/...",
      map: PreviousMap
    }
  }
}

😯 Current Behavior

I'm getting

root: {
  source: {
    input: {
      css: ".foo {\n color: red...",
      file: "/Users/...",
      from: "/Users/..."
    }
  }
}

💁 Possible Solution

Since it's working with webpack as expected and the CSS file emitted by parcel contains the source map I assume something is missing in the postcss implementation of parcel.

🔦 Context

I've built my PostCSS plugin with the goal to support as many bundlers & task runners as possible. But without access to the source map I cannot provide 100% compatibility to parcel.

💻 Code Sample

You can find the whole code example here:
https://github.com/SassNinja/postcss-extract-media-query/tree/feature/source-map/examples/parcel

🌍 Your Environment

Software Version(s)
Parcel 1.12.4
Node 10.16.0
npm 6.11.3
Operating System Mac OS X
@mischnic mischnic added the CSS Preprocessing All the PostCSS, Less, SASS, etc issues label Jan 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CSS Preprocessing All the PostCSS, Less, SASS, etc issues 🙋‍♀️ Feature
Projects
None yet
Development

No branches or pull requests

3 participants