liady / webpack-node-externals

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

version 3.0.0 - moduleFromFile fileName not working #111

Open sverraest opened 3 years ago

sverraest commented 3 years ago

Seems like the fileName is not picked up when using this plugin. See below, where I for testing purposes a completely fake path, it still just gives an error

Configuration:

externals: [
    'aws-sdk',
    nodeExternals({
      modulesFromFile: {
        fileName: path.join(__dirname, "../../totally-fake-file.json")
      }
    })
  ],
  Error: ENOENT: no such file or directory, open '/my-working-dir/sub1/package.json'

My package.json is in a higher folder and I need to set it explicitly but the path is not being picked up when running this.