Cannot import from node_modules without `native: true` (documentation?)
See original GitHub issueThis issue may be a lack of precise documentation.
If this is the case, I will write a PR with the relevant part included, or an example.
Problem
The only way of importing an external sass file (external = from node_modules
) is to set native: true
and with an @import
from node_modules
(full path or with an includePaths
).
Example
Here is the one solution (lost a couple of hours to find out) on how to import “normalize-scss” from node_modules
.
front/app/app.scss
:
@import "node_modules/normalize-scss/sass/normalize/import-now";
// "normalize/import-now" comes from normalize-scss documentation
// @import "normalize/import-now" should work with an includePath in brunch-config
brunch-config.js
:
module.exports = {
plugins: {
sass: {
mode: 'native', // does not work without, or with 'ruby'
}
},
};
Versions
brunch: 2.9.1
node-sass: 3.8.0
sass-brunch: 2.9.0
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Jest gives `Cannot find module` when importing components ...
Which says that each module you import will be looked into node_modules first and if not found will be looked into src directory....
Read more >CommonJS modules | Node.js v19.3.0 Documentation
For a file foo.js , this will be true if run via node foo.js , but false if run by ... to build...
Read more >eslint-plugin-import - npm
Start using eslint-plugin-import in your project by running `npm i ... names marked with @deprecated documentation tag ( no-deprecated ) ...
Read more >JavaScript/ES Modules and Imports - CodePen Blog
There is nothing that prevents you from using native JavaScript Modules (ESM or ES Modules) on CodePen. But there is stuff to know!...
Read more >Configuring Vitest
import { defineConfig } from 'vitest/config' export default ... Externalize means that Vite will bypass the package to native Node.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@denysdovhan I also noticed he didn’t have includePaths on his plugins / sass / options. That was also going to be my suggestion.
Include paths is documented in readme.md: https://github.com/brunch/sass-brunch#options
@tomsquest ¯_(ツ)_/¯