J
J
JohnDaniels2017-05-30 01:32:39
webpack
JohnDaniels, 2017-05-30 01:32:39

Why does webpack break build.js apart?

Hello.
I know about CommonsChunkPlugin, the problem is that it is not in the project.
config is like this

'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

it turns out
c3414b3a873b497789bce86d0429bcfe.png

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