JohnDaniels
@JohnDaniels

Почему webpack разбивает build.js на части?

Привет.
Про CommonsChunkPlugin знаю, проблема в том что в проекте его нет.

конфиг такой
'use strict'

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

const ExtractTextPlugin = require('extract-text-webpack-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')

const projectRoot = path.resolve(__dirname, '../')

const webpackConfig = {

    entry: {
        app: ['./application/view/admin/vue/client/index.js'],
        vendor: [ 'vue', 'vue-router', 'vuex', 'vuex-router-sync' ]
    },

    output: {
        path: path.resolve('public/build'),
        publicPath: 'build',
        filename: 'admin.js',
    },

    module: {
        loaders: [
            {
                test: /\.(js|vue)$/,
                loader: 'eslint-loader',
                include: projectRoot,
                exclude: /node_modules/,
                enforce: 'pre',
                options: {
                    formatter: require('eslint-friendly-formatter')
                }
            },
            {
                test: /\.vue$/,
                loader: 'vue-loader',
                options: require('./vue-loader.conf')
            },
            {
                test: /\.js$/,
                loader: 'babel-loader',
                include: projectRoot,
                exclude: [new RegExp(`node_modules\\${path.sep}(?!vue-bulma-.*)`)]
            },
            {
                test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
                loader: 'url-loader',
                query: {
                    limit: 10000,
                    name: 'assets/img/[name].[hash:7].[ext]'
                }
            },
            {
                test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
                loader: 'url-loader',
                query: {
                    limit: 10000,
                    name: 'assets/fonts/[name].[ext]'
                }
            }
        ]
    },

    resolve: {
        extensions: ['.js', '.vue', '.css', '.json'],
        alias: {
            package: path.resolve('application/view/admin/vue/package.json'),
            src: path.resolve(__dirname, '../client'),
            assets: path.resolve(__dirname, '../client/assets'),
            components: path.resolve(__dirname, '../client/components'),
            views: path.resolve(__dirname, '../client/views'),
            'plotly.js': 'plotly.js/dist/plotly',
            'vuex-store': path.resolve(__dirname, '../client/store')
        }
    },

    plugins: [

        new ExtractTextPlugin('assets/css/[name].[contenthash].css'),

        new HtmlWebpackPlugin({
            title: 'Vue prod Admin',
            filename:  path.resolve(__dirname, '../index.html'),
            template: 'application/view/admin/vue/indextmpl.html',
            inject: true,
            favicon: 'application/view/admin/vue/client/assets/logo.png',
            minify: {
                removeComments: false,
                collapseWhitespace: false,
                removeAttributeQuotes: false
            }
        }),
    ],
    // See https://github.com/webpack/webpack/issues/3486
    performance: {
        hints: false
    }
}

module.exports = webpackConfig


получается это
c3414b3a873b497789bce86d0429bcfe.png
  • Вопрос задан
  • 195 просмотров
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы