Answer the question
In order to leave comments, you need to log in
When is it not necessary to write an entry point in the webpack.config.js file and include require('path') and require('webpack')?
below is the code of the webpack config file, the code is working,
but why the path is missing, webpack, as it defines without entry , I can’t understand the entry point
var path = require('path')
var webpack = require('webpack')
and
entry: './ src/main.js',
const VueLoaderPlugin = require('vue-loader/lib/plugin');
module.exports = {
watch: true,
mode: 'none',
output: {
filename: 'main.js',
},
module: {
rules: [
{
test: /\.vue$/,
loader: 'vue-loader',
},
{
test: /\.(js)$/,
exclude: /(node_modules)/,
use: ['babel-loader', 'eslint-loader'],
},
],
},
plugins: [
new VueLoaderPlugin(),
],
};
Answer the question
In order to leave comments, you need to log in
Webpack has default values for all fields.
If these values are completely satisfied, then they can be safely omitted, to the point that webpack can work without a config at all.
require('path') is just a call to the path module built into node.js to work with paths, if we don't work with paths, then this module is not needed.
require('webpack') is a call to the module in the node_modules/webpack folder - webpack-cli connects the main functions from it itself, and the additional functions in this config are again not needed, and you can not connect them.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question