Skip to content

Instantly share code, notes, and snippets.

@laracasts
Last active February 27, 2020 08:42
Show Gist options
  • Save laracasts/53248fc965e8c250843dc5fcfec3230e to your computer and use it in GitHub Desktop.
Save laracasts/53248fc965e8c250843dc5fcfec3230e to your computer and use it in GitHub Desktop.

Revisions

  1. Laracasts revised this gist Jan 3, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion webpack.config.js
    Original file line number Diff line number Diff line change
    @@ -10,7 +10,7 @@ module.exports = {
    output: {
    path: path.resolve(__dirname, 'public/js'),
    filename: '[name].js',
    publicPath: './'
    publicPath: '/'
    },

    module: {
  2. Laracasts revised this gist Jan 3, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion webpack.config.js
    Original file line number Diff line number Diff line change
    @@ -10,7 +10,7 @@ module.exports = {
    output: {
    path: path.resolve(__dirname, 'public/js'),
    filename: '[name].js',
    publicPath: './public'
    publicPath: './'
    },

    module: {
  3. Laracasts revised this gist Jan 3, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion webpack.config.js
    Original file line number Diff line number Diff line change
    @@ -49,7 +49,7 @@ if (process.env.NODE_ENV === 'production') {
    module.exports.plugins.push(
    new webpack.DefinePlugin({
    'process.env': {
    NODE_ENV: 'production'
    NODE_ENV: '"production"'
    }
    })
    );
  4. Laracasts created this gist Jan 2, 2017.
    56 changes: 56 additions & 0 deletions webpack.config.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,56 @@
    let webpack = require('webpack');
    let path = require('path');

    module.exports = {
    entry: {
    app: './resources/assets/js/app.js',
    vendor: ['vue', 'axios']
    },

    output: {
    path: path.resolve(__dirname, 'public/js'),
    filename: '[name].js',
    publicPath: './public'
    },

    module: {
    rules: [
    {
    test: /\.js$/,
    exclude: /node_modules/,
    loader: 'babel-loader'
    }
    ]
    },

    resolve: {
    alias: {
    'vue$': 'vue/dist/vue.common.js'
    }
    },

    plugins: [
    new webpack.optimize.CommonsChunkPlugin({
    names: ['vendor']
    })
    ]
    };

    if (process.env.NODE_ENV === 'production') {
    module.exports.plugins.push(
    new webpack.optimize.UglifyJsPlugin({
    sourcemap: true,
    compress: {
    warnings: false
    }
    })
    );

    module.exports.plugins.push(
    new webpack.DefinePlugin({
    'process.env': {
    NODE_ENV: 'production'
    }
    })
    );
    }