Open larionov opened 5 years ago
<style lang="scss">
is handled by rollup-plugin-vue which compiles sass using @vue/component-compiler-utils
which currently doesn't support the ~
alias. ~
only works in normal import style from './style.scss'
because this is compiled by rollup-plugin-postcss.
Related: https://github.com/vuejs/component-compiler-utils/issues/49
Ok, that's unfortunate. Thank you!
You can use https://rollup-plugin-vue.vuejs.org/options.html#style-preprocessoptions to set sass options, ~
is implemented in rollup-plugin-postcss via the importer
option: https://github.com/egoist/rollup-plugin-postcss/blob/e63c9ae659fe4e982fa8d31c955767c2a5e6e98f/src/sass-loader.js#L38
I'll try to make bili support this by default, not anytime soon though.
We went with magic-importer
:
bili.config.js
import path from 'path';
import magicImporter from 'node-sass-magic-importer';
const config = {
plugins: {
vue: {
style: {
preprocessOptions: {
scss: {
importer: magicImporter(),
},
},
},
},
},
};
export default config;
That's awesome then 👌🏻
Hello! I'm trying to use vue plugin and importing sass from node_modules there with '~' syntax. It's important for me to use that syntax and not relative './node_modules/...' because the component is a part of the library and I want it to be importable as a .vue file (along with bili build).
When I'm running bili on that file I get the error:
Here is a minimal repository where the error can be reproduced: https://github.com/larionov/bili-vue-sass-import-tilde-example