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
Simplify importing index.scss in an npm package #535
Comments
@sindresorhus thanks for issue, maybe we can use |
I'm not sure what |
|
@michael-ciniawsky need add tests for this 👍 |
Only problem is not everyone will expect this behavior no? It would be a webpack/webpack@WebpackOptionsDefaulter change. |
Note node-sass@5 will automatically support |
Thanks to mainFields in webpack.config.js, you can resolve file with "sass" or "style" fields from package.json of the npm package.
Then you can import stylesheet with |
@evilebottnawi actually a loader can register its own resolve option. It does work ! |
@pitpit how? Without hacks? |
no hacks. Look at this repo https://github.com/pitpit/saas-field |
@pitpit yep, here issue about what it should be by default for |
Need support |
… be able to import via index.scss file See webpack-contrib/sass-loader#535
Given that there's no *automatically configured* way to specify a target SCSS file as the index, using package.json, we just make the import path as obvious & forward-compatible as possible See what's required in Webpack to be able to do without the : https://github.com/pitpit/saas-field/blob/master/webpack.config.js\#L19-L22 & webpack-contrib/sass-loader#535
… be able to import via index.scss file See webpack-contrib/sass-loader#535
Given that there's no *automatically configured* way to specify a target SCSS file as the index, using package.json, we just make the import path as obvious & forward-compatible as possible See what's required in Webpack to be able to do without the : https://github.com/pitpit/saas-field/blob/master/webpack.config.js\#L19-L22 & webpack-contrib/sass-loader#535
Let's say an npm package named
foo
contains:Currently, I can use the following to import it:
But it would be nicer if we could just import it as:
Like with JS npm packages.
The text was updated successfully, but these errors were encountered: