Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can I use virtual module as entry point? #22

Open
axetroy opened this issue Mar 10, 2018 · 6 comments
Open

Can I use virtual module as entry point? #22

axetroy opened this issue Mar 10, 2018 · 6 comments

Comments

@axetroy
Copy link

axetroy commented Mar 10, 2018

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
Copy link
Author

axetroy commented Mar 10, 2018

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
Copy link
Owner

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
Copy link
Author

axetroy commented Mar 12, 2018

Here is the relative issue webpack/webpack#6437

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

@develar
Copy link

develar commented Mar 18, 2018

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

@ccfe
Copy link

ccfe commented Aug 21, 2019

has plan to fix this in webpack4 ?

@dennisreimann
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants