TehShrike / svelte-preprocess-postcss

Use PostCSS to preprocess your styles in Svelte components
25 stars 4 forks source link

Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning. #2

Closed bahador closed 5 years ago

bahador commented 6 years ago

I get the following error when running rollup: Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.

here's the svelte config in rollup.config.js:

    svelte({
      css: function (css) {
        css.write(`public/build/styles.${hash}.css`, !production)
      },
      hydratable: true,
      preprocess: {
        style: sveltePreprocessPostcss({
          configFilePath: '',
          useConfigFile: true,
          plugins: []
        })
      }
    })

and here's my postcss.config.js:

module.exports = {
  from: undefined,
  plugins: []
}

i can fix this if i edit this line: https://github.com/TehShrike/svelte-preprocess-postcss/blob/master/index.js#L20 to be this: .process(css, { from: undefined })

but this is probably wrong...

TehShrike commented 6 years ago

Thanks for raising this issue - I've just been ignoring that (it's just a warning, not an error).

I haven't known what, if anything, it would make sense to set the from to :-x

So, it's probably fine to set it to undefined just to make the warning go away?

bahador commented 6 years ago

i'm not sure, to be honest. i'd try false and go with that if it worked.

dalisoft commented 5 years ago

Same issue for me

yaliv commented 5 years ago

Please... :hammer: it.

TehShrike commented 5 years ago

Has anyone tested an alternative?

TehShrike commented 5 years ago

Pull requests are welcome

yaliv commented 5 years ago

Setting from: undefined in postcss.config.js has no effect here.

And at least I've tried codes from this PR for the from config to work. So I think it's good to merge that one.

TehShrike commented 5 years ago

Published as 1.1.0 – let me know if there are any issues.