Scaffolding react configure multiple compilation inlet TypeError: Can not read property 'filter' of undefined

Due to recent project needs, you need to configure multiple entry compilation, which is a html js corresponds to one entry so go online to search, are probably such a step

Such as the address
to configure multiple inlet tutorial
. 1, App MyApp Create-REACT-
2, may be performed npm run eject the exposed profile webpack out
3, and then modify the configuration file entry webpack plurality of entry.
This is roughly the steps
it! ! I was unsuccessful configuration,
the configuration of the entrance

entry:{
	index:'./src/index.js',
	admin:'./src/admin.js'
}

Emergence
of undefined Can not read property 'filter
': TypeError wrong, so I began to study. We discovered the error location

      new ManifestPlugin({
       。。。。。。
          const entrypointFiles = entrypoints.main.filter(
            fileName => !fileName.endsWith('.map')
          );
          。。。。。
        },
      }),

The inlet is provided only find here in the form of an array,

What to take a look at the react-scripts that? ?
Let's look at what the eject package.json that? Find

scripts:{
	'eject':react-scripts eject
}

react-scripts is a core package create-react-app, and some default configuration scripts and tools are integrated in it, but after npm run eject command will be executed in the configuration package create-react-app of all to the current decompile project, so that users will be able to fully take control of webpack file. So, the meaning of existence is to eject command to change the configuration of existing webpack ah!
Go look for the following node_moudules found react-scripts source code,
Here Insert Picture Description
the original is not the same because the configuration of the Internet config folder are following figure
Here Insert Picture Description
found is because react-scripts version of the problem, react-scripts do not support the @ 3 entry for the object I do not know why, I hope someone answers.
But eject operation is not reversible needs
1, re-create projects
2, reduced version

npm i --save react-scripts@1.*

Well now you can do based on other people's steps

But the new version of why not? Perhaps I did not get to know, I do not say, do not fraught, ha ha! !

Published 14 original articles · won praise 8 · views 6135

Guess you like

Origin blog.csdn.net/KangTongShun/article/details/104380028