rmarscher / virtual-module-webpack-plugin

Adds the contents of a virtual file to webpack's cached file system without writing it to disk
174 stars 17 forks source link

Can I use virtual module as entry point? #22

Open axetroy opened 6 years ago

axetroy commented 6 years ago
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 commented 6 years ago

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'
rmarscher commented 6 years ago

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.

axetroy commented 6 years ago

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

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

develar commented 6 years ago

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

ccfe commented 5 years ago

has plan to fix this in webpack4 ?

dennisreimann commented 5 years ago

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