U
U
uzi_no_uzi2019-09-05 12:16:03
JavaScript
uzi_no_uzi, 2019-09-05 12:16:03

webpack4 ELIFECYCLE error?

There is such a webpack4 config

//dependencies

const path = require('path');
const webpack = require('webpack');
const less = require('less');


//plugins

const HtmlWebpackPlugin = require('html-webpack-plugin');

module.exports = {
    entry: {
        app: './src/index.js',
    } 
    output: {
        path: __dirname + '/dist'
        publicPath: '/dist',
        filename: 'js/[name].js'
    },
    devServer: {
        contentBase: './dist',
    },
    module: {
        rules: [
            {
                test: /\.html$/,
                use: [
                    {
                        loader: 'html-loader',
                    }
                ]
            },
            {
                test: /\.less$/,
                use: [
                    {
                        loader: 'style-loader'
                    },
                    {
                        loader: 'css-loader'
                    },
                    {
                        loader: 'less-loader'
                    },
                ]
            }

        ]
    },
    plugins: [
        new HtmlWebpackPlugin({
            filename: './index.html',
            template: 'src/template/index.html'
        }),
    ]
}

When run, it gives the following error:
iuyF6.png
index.js - empty
The file structure looks like this: enter image description here
ufQgs.png
What could be the problem? I think there is something wrong with the paths

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question