webpack-node-externals icon indicating copy to clipboard operation
webpack-node-externals copied to clipboard

Option 'includeAbsolutePaths' can't work well with inline loader

Open licg9999 opened this issue 2 years ago • 0 comments

Hi, there. I found an interesting case that can be consistently reproduced. If I specify option 'includeAbsolutePaths' and use an inline loader which contains a sub path '/node_modules/', webpack-node-externals would mistakenly externalize the target file that should be imported. For example:

// webpack.config.js
...
  externals: [nodeExternals({ includeAbsolutePaths: true })],
...
// entry file
import { greeting } from '!../node_modules/babel-loader/lib/index.js!./constants';

In this case, the file constants should be imported but in fact it's externalized. I created a repo licg9999/b6881284 so that you can reproduce the abnormally. Would you help fix it? Or do you mind my fixing it? Thanks.

licg9999 avatar Oct 14 '22 14:10 licg9999