ERROR in Entry Module not found: ERROR: Can’t resolve ‘./ SRC ‘in’ E:\ Documents\VSCode files\WebPackProject ‘
Specify the inlet and outlet through the configuration file
Js (must be in the project root directory)
const path = require('path');
module.exports = {
entry: './src/index.js',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'bundle.js'
}
};
Not packaged by configuration file
By default, Webpack4 does not need to create webpack.config.js to configure the packaged entry and exit.
By default,
The entry is ./ SRC /index.js
file
Exit to ./dist/main.js
file
Directory structure:
Js is in the correct position. Run the command in the project root directory:
webpack
You are ready to pack.
So now you can see that under the project directory, dist
folder, you’ll see the packaged file main.js
;
In the HTML file index. HTML
which needs to be introduced, it can be correctly introduced.
You can also specify it manually using the following command:
webpack./SRC /index.js -- output-filename. /dist/main.js --output-path. --mode development
or
webpack ./src/index.js -o ./dist/main.js --mode development
note:
, --mode development
is the specified development mode, without which warning will be reported;
Another mode is --mode production
specifies the production mode. In this mode, the packaged js file will be compressed, but the former will not.
Webpack will prompt a warning when executing directly from above. Closing the warning can be packaged by the following command:
webpack --mode development
or
webpack --mode production
`
Read More:
- ERROR in Entry module not found Error Can t resolve
- Error in entry module not found: error: can’t resolve ‘Babel loader’
- Module not found: Error: Can’t resolve ‘sass-loader’ in ‘F:\H5\project-h5’
- Module not found:Error:Can’t resolve ‘rc-animate/lib/CSSMotionList’ in ‘……’
- npm start:Module not found: Error: Can’t resolve ‘xlsx’ in ‘/Users/huzhiqi/Downloads/web/…
- Module not found: Error: Can’t resolve ‘./$$_gendir/app/app.module.ngfactory’
- Error: can’t resolve ‘FS’ in (webpack 2 configures CSS loaders)
- NPX webpack cannot find module’html webpack plugin’a bug causes headache
- ./src/router/index.js Module not found: Error: Can‘t resolve ‘@/views/tet_demo‘ in ‘D:\admin\src\rou
- Webpack Upgrade Error: webpack.NamedModulesPlugin is not a constructor
- Webpack error module build failed: typeerror: fileSystem.statSync is not a function
- Run webpack error: Error: Cannot find module’webpack/lib/node/NodeTemplatePlugin’
- Has HTML webpack plugin been installed, or error: cannot find module ‘HTML webpack plugin’
- Error: unable to resolve dependency for… Could not resolve project
- Cannot find module ‘webpack cli / bin / config yargs‘
- Failed to load bundle…Unable to resolve module `xxx` from xxx: Module `xx` does not exist
- Error: Cannot find module’webpack/bin/config-yargs’ solution
- Solved – problem cannot find module ‘webpack / bin / config yargs’
- Error: cannot find module ‘webpack / lib / ruleset’_ solve
- [Solved] Error: Cannot find module ‘webpack/lib/RequestShortener’