-
Notifications
You must be signed in to change notification settings - Fork 76
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
Fail to locate @import file "~@pkg/style.styl" in node_modules #49
Comments
this is the most problematic in |
it looks like |
@KarlBao @r4fx after few hours of debugging, i found a fix which works. In your rollup config, add :
vue({
style: {
preprocessOptions: {
stylus: { Evaluator }
}
}
}),
const visitImport = Evaluator.prototype.visitImport
Evaluator.prototype.visitImport = function(imported) {
const path = imported.path.first
if (path.string.startsWith('~'))
path.string = path.string.replace('~', '').replace('@', '/whatever-absolute-path-we-want/src')
return visitImport.call(this, imported)
} This dirty solution works as a workaround and should definitely be addressed in other way. Although, it works cleanly enough not to relay on any dirty patch located in
|
@y-nk You rock, man! It works well! |
TEST FAILED OUTPUT: src/components/XmWallet/__test__/XmSimpleCard.spec.ts [ src/components/XmWallet/__test__/XmSimpleCard.spec.ts ] ReferenceError: ~/xmiles/taro-weapp/src/components/XmWallet/src/xmWallet.module.styl:1:9 1| @import "~@/styles/theme/vars" --------------^ 2| 3| .wrapper 4| position relative aliases is not defined // RESOLUTION: // @ see vuejs/component-compiler-utils#49
Expected behavior
Expect to locate the
.styl
file fromnode_modules
with~
(which works well when bundled with Webpack)Actual behavior
Get the error:
However, when I import the
.styl
file with relative path:It works fine.
Steps to reproduce the behavior
My rollup config:
The text was updated successfully, but these errors were encountered: