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.

node_modules folder created in my build folder

See original GitHub issue

Hi @Anidetrix , After adding this plugin 2 files created in bellow path, Have you any idea about this? How I can prevent this?

build/node_modules/rollup-plugin-styles/dist/runtime/inject-css.js
build/node_modules/rollup-plugin-styles/dist/runtime/inject-css.js.map

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
prma85commented, Aug 13, 2021

You can solve it using 2 plugins 😃

import replace from '@rollup/plugin-replace';
import rename from 'rollup-plugin-rename';

export default {
  // your configuration
  plugins: [
    // your other plugins
    rename({
      include: ['**/*.js', '**/*.mjs'],
      map: (name) => name.replace('node_modules/', 'external/'),
    }),
    replace({
      values: {
        'node_modules/': 'external/'
      },
      delimiters: ['', '']
    })
  ],
}
0reactions
Anidetrixcommented, Jan 27, 2021

I’m afraid nothing can be done with this at the moment due to how Rollup’s preserveModules option works.

It’s explained in this comment:

The folder is created because preserveModules is preserving the original file names and directory structure. It does not understand that node_modules is something special, though. Also, all exports are rewritten in a way that does not depend on Node’s dependency resolution algorithm.

Read more comments on GitHub >

github_iconTop Results From Across the Web

npm install doesn't create node_modules directory
Now it will create node_modules directory under folder 'project-name' you created. Installation directory switches in build process & was missing npm init so ......
Read more >
What's Really Going On Inside Your node_modules Folder?
Here's another way to look at. We created a visualization to show you what the dependency tree of a typical package looks like....
Read more >
Check in your node_modules folder - seriesci blog
First of all remove node_modules from your .gitignore file. This is huge and you will suddenly see a lot of untracked files on...
Read more >
Quickly remove all node_modules folders from ... - Codementor
In this article, you will see how to quickly remove all the node_module folders from your system in a single click to free...
Read more >
node_modules folder is always marked as "library root" with ...
2 (8/16/16 build), my application code inside the 2nd node_modules folder is no longer inspected by WebStorm for validity, intellisense, etc and all...
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