2018-package-three-webpack-plugin icon indicating copy to clipboard operation
2018-package-three-webpack-plugin copied to clipboard

Cannot read property 'normalModuleFactory' of undefined

Open metipton opened this issue 6 years ago • 6 comments

When setting up the webpack plugin for a react app, I am receiving the following error when running npm start.

Cannot read property 'normalModuleFactory' of undefined

I have included the two lines in my webpack.config.dev.js file:

   const ThreeWebpackPlugin = require('@wildpeaks/three-webpack-plugin'); ( at the top)

   module.exports = {
           // .......... ,
          plugins: [
                    ///other plug ins,
                    new ThreeWebpackPlugin()
            ],
     },

Does ThreeWebpackPlugin take an argument? Any help would be much appreciated!

metipton avatar Aug 26 '18 16:08 metipton

Same issue for me

hailengc avatar Aug 27 '18 08:08 hailengc

@soccer1mt are you using create-react-app? Did you put the plugin in the ejected webpack config?

If so, what version of react-scripts are you using? (check it from the package.json)

marcofugaro avatar Aug 27 '18 09:08 marcofugaro

It does not work with webpack@^3.10.0.

yiakwy avatar Nov 08 '18 13:11 yiakwy

It is because the developer are using webpack 4, however most the products are developed by webpack3.

yiakwy avatar Nov 08 '18 13:11 yiakwy

@yiakwy use a previous version of this plugin if you use webpack 3.

Webpack4 has been the major version for quite some time now (10 months), it is normal that this plugin supports only webpack4.

https://github.com/wildpeaks/package-three-webpack-plugin/releases

marcofugaro avatar Nov 08 '18 14:11 marcofugaro

@marcofugaro webpack 4 released on Feb 25, 2018, and I keep my eye on it. I will switch to it if I start a new and light project. That will be a disaster to change underline tools if you have intensive dependencies from old projects. We have been using webpack 3 since Jun 19, 2017.

And your solution is neat but might not work. Actually, I have resolved the problem by manually adding searching path to the unofficial libraries. If you installed three using npm, it won't include editor and examples modules. This is the key problem why we appeal three to release them.

yiakwy avatar Nov 18 '18 17:11 yiakwy