- My project is a monorepo that has structure:
name
-node_modules
-@name/theme
-@name/client
-packages
-client
-node_modules
-src
-style.module.scss
-theme
-node_modules
-src
-_variables.scss
@import "~@name/themes/src/variables";
.class-a{
property: $var
}
- I add the watch:
"watch:style": "node-sass-chokidar --include-path ../../node_modules ./src -o ./build --watch --recursive --ext scss", when I change style.module.scss, it shows an erorr:
{
"status": 1,
"file": ".../name/packages/client/src/styles.module.scss",
"line": 1,
"column": 1,
"message": "File to import not found or unreadable: ~@name/theme/src/variables",
"formatted": "Error: File to import not found or unreadable: ~@name/theme/src/variables.\n ........"
}
remove the ~ will make the watch runs success but it makes the build failed because the import in style.module.scss does not find the @name/themes in current node_modules, it should find in the root node_modules by adding ~
I have a
_variables.scssinthemespackage.I import this file in the
clientpackage >style.module.scss"watch:style": "node-sass-chokidar --include-path ../../node_modules ./src -o ./build --watch --recursive --ext scss",when I changestyle.module.scss, it shows an erorr:remove the
~will make the watch runs success but it makes the build failed because the import instyle.module.scssdoes not find the@name/themesin currentnode_modules, it should find in the rootnode_modulesby adding~