Closed chiboreache closed 3 years ago
I'm seeing the problem too. Looks like the alias links are not being referenced correctly.
using @import '@/css/main';
has same error as using @import "~styles/main"
replacing with relative path works though
@import '../css/main';
or @import "../../node_modules/styles/main"
Fixed in master, release will be soon, after release you need update stylus-loader
, maybe you need to open an issue in vue-cli
Hello everyone! I'm getting this issue too, using webpack: 4.44.1
and stylus-loader: 4.1.1
.
1| @require '~styles/placeholders/base-block';
---------------^
2| @require '~styles/placeholders/details';
3| @require '~styles/placeholders/arrow-link';
4|
failed to locate @require file ~styles/placeholders/base-block.styl
Here is my webpack config:
{
test: /\.styl$/,
use: [
{
loader: 'stylus-loader',
options: {
stylusOptions: {
use: [
postStylus([
'autoprefixer',
'css-mqpacker',
'rucksack-css',
'lost',
]),
require('rupture')()
],
paths: [
path.resolve(__dirname, '../', 'app/styles'),
path.resolve(__dirname, '../', 'node_modules')
],
include: [path.resolve(__dirname, '../', 'app/styles')],
import: [
'rupture',
],
},
webpackImporter: false,
}
}
]
}
As @dasDaniel mentioned, using a relative path like @require '../../styles/placeholders/base-block';
works perfectly.
I've also read in the docs, if we use ~
to prepend paths, it will search directly in the node_modules
. So I've tried the following paths to my file:
@require '~/styles/placeholders/base-block'
@require '~@/styles/placeholders/base-block'
@require '@/styles/placeholders/base-block'
At this point I'm just guessing paths hahah. Anyone has a clue on why stylus-loader is failing to locate my .styl
files? Or if is it a bug, how can we help fix it?
Thank you in advance
Hi! I have an issue here