question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot import from node_modules without `native: true` (documentation?)

See original GitHub issue

This 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:closed
  • Created 7 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
kgcreativecommented, Jan 20, 2017

@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

0reactions
denysdovhancommented, Jan 23, 2017

@tomsquest ¯_(ツ)_/¯

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found