-
-
Notifications
You must be signed in to change notification settings - Fork 430
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
webpack alias with tilde not working for imports #566
webpack alias with tilde not working for imports #566
Comments
@philippkuehn please create minimum reproducible test repo |
Link to Repo: https://github.com/philippkuehn/sass-loader-alias-bug After some testing I found out that this error only occurs in combination with Vue. |
I'm seeing |
I'm not using Vue either. |
Try:
in webpack config |
I think I'm seeing #556 |
which, I think this issue and #567 are all related. |
@evilebottnawi thanks for the suggestion. I tried that, but no success. I've rolled back to 6.x for now. |
@jsg2021 in theory solution should be solve your problem, can you create minimum reproducible test repo? |
@evilebottnawi Here you go: https://github.com/jsg2021/style-loader-scoped-import-failure you will probably need to normalize.css imports fine, but the scoped import fails. |
same problem, is there a solution? |
Very interesting without |
Found problem, https://github.com/webpack-contrib/sass-loader/blob/master/lib/importsToResolve.js#L6 use |
Write tests is hard, a spend 1 hours on issue and spend 4 hours on tests, but did not make it |
A fix shipped with |
I still have problems with ~ syntax. I have
Chrome console
Webpack config style rules:
I tried Any suggestions? Maybe I did something wrong? |
Hi, :) // part of webpack.config.js
alias: {
~foo: '/path/to/foo'
}
// usage
@import '~~foo/bar.css' would the alias start with |
still have problems with this in const postcssPlugins = () => [
require('postcss-flexbugs-fixes'),
autoprefixer({ flexbox: 'no-2009' }),
postCSSCustomProperties({ warnings: true })
];
module.exports = {
output: {
path: path.resolve(__dirname, 'dist'),
publicPath: '/cwp/static/'
},
alias: {
assets: path.resolve("assets")
}
module: {
rules: {
test: /\.scss$/,
use: [
'raw-loader',
{
loader: 'postcss-loader',
options: {
plugins: postcssPlugins
}
},
'sass-loader'
]
},
... styles.scss
In browser:
|
Hi was this resolved? However, my configuration currently works for aliases with .jsx and .js
|
On {
loader: 'sass-loader',
options: {
webpackImporter: true
}
} |
Bump |
For me it is not working with a full path to the CSS file like This feature is at least used by Webpack Encore, described in https://symfonycasts.com/screencast/webpack-encore/css, start at 2:50min... Might help someone? |
|
Don't forget
What is the error? |
|
@rintisch Can you create simple reproducible test repo? I will look |
I will try, but not these days. Too busy :-/ |
So how to resolve this then?
It's a reference in my Angular module. And there it points to the correct direction. But when I publish it and install to the target app, it points to "https://localhost:4200/~mapbox-gl/dist/mapbox-gl.css", not to "node_modules/mapbox-gl/dist/mapbox-gl.css". |
@alexandis When you write |
Hmm... Is there a simpler way to reference 3rd party css in my Angular library without need to directly reference them in the app I install my library into and / or without need to use another bunch of plugins like style-loader, etc.? I've tried to use different configuration settings to point my app where to look for css (e.g. |
@alexandis Sorry, I don't know angular CLI, I think better to ask them (angular-cli team), I think it should be simple |
With sass-loader < 7.0.0 this worked fine
With sass-loader >= 7.0.0
Is this an expected behavior or an bug?
The text was updated successfully, but these errors were encountered: