virtual-module-webpack-plugin icon indicating copy to clipboard operation
virtual-module-webpack-plugin copied to clipboard

Can I use virtual module as entry point?

Open axetroy opened this issue 6 years ago • 6 comments

const webpackConfig = {
      entry: "/path/to/virtual/file/module.js",
      plugins:[
        new VirtualModulePlugin({
          moduleName: "/path/to/virtual/file/module.js",
          contents: `// here is the javascript code`
        })
      ]
    }

axetroy avatar Mar 10 '18 08:03 axetroy

I try it in webpack@4, It seem not work

ERROR in Entry module not found: Error: Can't resolve '/path/to/virtual/file/module.js' in 'xxx'

axetroy avatar Mar 10 '18 08:03 axetroy

Ok. I haven’t tried that before. I should test it with webpack 2 to see if it has ever worked with this plugin. Let me know if you get a chance - should be easy to modify the example for webpack-2 in here to test. Thanks.

rmarscher avatar Mar 11 '18 19:03 rmarscher

Here is the relative issue https://github.com/webpack/webpack/issues/6437

I have try it in entry point, and it didn't work.

axetroy avatar Mar 12 '18 05:03 axetroy

It works for webpack 3, but broken since webpack 4.

develar avatar Mar 18 '18 11:03 develar

has plan to fix this in webpack4 ?

ccfe avatar Aug 21 '19 12:08 ccfe

fyi: This plugin works for me with Webpack 4: webpack-virtual-modules

dennisreimann avatar Aug 24 '19 19:08 dennisreimann