V
V
vitaly_742021-11-19 09:39:18
npm
vitaly_74, 2021-11-19 09:39:18

Why does npm run build take a long time to build the project?

or for example I run npm run watch - then nothing happens at all.
(I'm running inside a docker container.

asset vue.js 1.21 MiB [emitted] (name: main)
runtime modules 1.13 KiB 5 modules
modules by path ./node_modules/ 379 KiB
  modules by path ./node_modules/axios/ 39.6 KiB 26 modules
  modules by path ./node_modules/style-loader/dist/runtime/*.js 5.75 KiB 6 modules
  modules by path ./node_modules/css-loader/dist/runtime/*.js 2.94 KiB 2 modules
  ./node_modules/vue/dist/vue.js 328 KiB [built] [code generated]
  ./node_modules/vue-loader/lib/runtime/componentNormalizer.js 2.71 KiB [built] [code generated]
modules by path ./src/ 47.5 KiB
  modules by path ./src/components/ 43.6 KiB
    modules by path ./src/components/tasks/*.vue 22.3 KiB 10 modules
    modules by path ./src/components/auth/*.vue 21.3 KiB 10 modules
  modules by path ./src/css/*.css 3.29 KiB
    ./src/css/cloak.css 1.22 KiB [built] [code generated]
    ./node_modules/css-loader/dist/cjs.js!./node_modules/sass-loader/dist/cjs.js!./src/css/cloak.css 2.07 KiB [built] [code generated]
  ./src/main.js 632 bytes [built] [code generated]
webpack 5.54.0 compiled successfully in 12805 ms

13 seconds is too long.
here is the webpack config:
const { VueLoaderPlugin } = require('vue-loader');
const path = require('path');

module.exports = {
    mode: 'development',
    devtool: "eval-cheap-module-source-map",
    entry: './src/main.js',
    output: {
        path: path.join(__dirname, '../web/js'),
        filename: 'vue.js'
    },
    module: {
        rules: [
            {
                test: /\.vue$/,
                loader: 'vue-loader',
            },
            {
                test: /\.js$/,
                use: {
                    loader: "babel-loader",
                    options: {
                        cacheDirectory: true
                    }
                }
            },
            {
                test: /\.scss$/,
                use: [
                    'style-loader',
                    'css-loader',
                    'sass-loader'
                ]
            },
            {
                test: /\.css$/,
                use: [
                    'style-loader',
                    'css-loader',
                    'sass-loader'
                ]
            }
        ],
    },
    plugins: [
        new VueLoaderPlugin(),
    ],
    resolve: {
        alias: {
            vue: 'vue/dist/vue.js'
        },
    },
};

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