我试图在vue组件中导入我的variables.stylus,但是当我使用@import "~@themes/variables.stylus"时,webpack抛出了错误:failed to locate @import file ~@themes/variables.stylus.styl
webpack配置
alias: {
'vue$': 'vue/dist/vue.esm.js',
themes: path.resolve(__dirname, './src/themes'),
'@': resolve('src'),
}
{
test: /\.styl$/,
loader: ['style-loader', 'css-loader', 'autoprefixer-loader?browsers=last 5 version', 'stylus-loader']
}发布于 2019-04-04 10:25:49
我相信应该是这样的:
@import '~@/themes/variables.stylus';Webpack用配置中的路径替换别名@,在本例中是src。所以导入变成了src/themes/variables.stylus。
https://stackoverflow.com/questions/55512453
复制相似问题