liady / webpack-node-externals

Easily exclude node modules in Webpack
MIT License
1.3k stars 62 forks source link

modulesFromFile has no effect! #69

Closed grapewheel closed 3 years ago

grapewheel commented 5 years ago

version: 1.7.2

webpack config

externals: [
        nodeExternals({
            modulesFromFile: { // Or true
                exclude: ['devDependencies'],
                include: ['dependencies']
            }
        })
    ]

But still external all the modules

thiagotigaz commented 5 years ago

I'm having the sam problem, I have the exact same configuration and my bundle is almost 4mb, when i don't use it and have the node_modules folder present everything is less than 250kb.

It's bundling built ins node modules on it.

liady commented 4 years ago

@grapewheel do you need to actually bundle the devDependencies? Note that using the modulesFromFile is advisable only if the default setting (i.e getting the modules list from node_modules) does not work.

liady commented 3 years ago

@grapewheel @thiagotigaz note that you can use now excludeFromBundle and includeInBundle which might be clearer. Closing for now, let me know if the problem persists.