2018-06-04 03:03:46 +02:00
|
|
|
const path = require('path');
|
2018-06-04 03:46:27 +02:00
|
|
|
const CleanPlugin = require('clean-webpack-plugin');
|
|
|
|
const ExtractTextPlugin = require('extract-text-webpack-plugin');
|
2018-06-04 03:03:46 +02:00
|
|
|
const ManifestPlugin = require('webpack-manifest-plugin');
|
2018-06-04 03:46:27 +02:00
|
|
|
const ShellPlugin = require('webpack-shell-plugin');
|
2018-06-04 03:03:46 +02:00
|
|
|
const UglifyJsPLugin = require('uglifyjs-webpack-plugin');
|
|
|
|
|
2018-03-31 06:58:38 +02:00
|
|
|
module.exports = {
|
2018-06-04 02:40:35 +02:00
|
|
|
mode: 'development',
|
2018-06-04 03:03:46 +02:00
|
|
|
devtool: 'source-map',
|
2018-06-04 02:40:35 +02:00
|
|
|
performance: {
|
|
|
|
hints: false,
|
|
|
|
},
|
2018-06-04 03:46:27 +02:00
|
|
|
// Passing an array loads them all but only exports the last.
|
|
|
|
entry: ['./resources/assets/styles/main.css', './resources/assets/scripts/app.js'],
|
2018-03-31 06:58:38 +02:00
|
|
|
output: {
|
2018-06-04 03:46:27 +02:00
|
|
|
path: path.resolve(__dirname, 'public/assets'),
|
2018-06-04 03:53:27 +02:00
|
|
|
filename: 'bundle-[chunkhash].js',
|
2018-06-04 03:46:27 +02:00
|
|
|
publicPath: '/assets/',
|
|
|
|
crossOriginLoading: 'anonymous',
|
2018-03-31 06:58:38 +02:00
|
|
|
},
|
|
|
|
module: {
|
|
|
|
rules: [
|
|
|
|
{
|
|
|
|
test: /\.vue$/,
|
|
|
|
loader: 'vue-loader',
|
|
|
|
options: {
|
|
|
|
postcss: [
|
|
|
|
require('postcss-import'),
|
|
|
|
require('postcss-preset-env')({stage: 0}),
|
|
|
|
require('tailwindcss')('./tailwind.js'),
|
|
|
|
require('autoprefixer'),
|
|
|
|
]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.js$/,
|
2018-06-04 03:03:46 +02:00
|
|
|
include: [
|
|
|
|
path.resolve(__dirname, 'resources/assets/scripts'),
|
|
|
|
],
|
2018-06-04 03:46:27 +02:00
|
|
|
loader: 'babel-loader',
|
2018-03-31 06:58:38 +02:00
|
|
|
},
|
2018-06-04 03:46:27 +02:00
|
|
|
{
|
|
|
|
test: /\.css$/,
|
|
|
|
include: [
|
|
|
|
path.resolve(__dirname, 'resources/assets/styles'),
|
|
|
|
],
|
|
|
|
use: ExtractTextPlugin.extract({
|
|
|
|
fallback: 'style-loader',
|
|
|
|
use: ['css-loader', {
|
|
|
|
loader: 'postcss-loader',
|
|
|
|
options: {
|
|
|
|
ident: 'postcss',
|
|
|
|
plugins: [
|
|
|
|
require('postcss-import'),
|
|
|
|
require('postcss-preset-env')({stage: 0}),
|
|
|
|
require('tailwindcss')('./tailwind.js'),
|
|
|
|
require('autoprefixer'),
|
|
|
|
]
|
|
|
|
},
|
|
|
|
}],
|
|
|
|
}),
|
|
|
|
}
|
2018-03-31 06:58:38 +02:00
|
|
|
]
|
|
|
|
},
|
|
|
|
resolve: {
|
|
|
|
alias: {
|
2018-03-31 22:51:18 +02:00
|
|
|
'vue$': 'vue/dist/vue.esm.js'
|
2018-03-31 06:58:38 +02:00
|
|
|
},
|
|
|
|
extensions: ['*', '.js', '.vue', '.json']
|
|
|
|
},
|
2018-06-04 03:03:46 +02:00
|
|
|
plugins: [
|
2018-06-04 03:46:27 +02:00
|
|
|
new CleanPlugin(path.resolve(__dirname, 'public/assets')),
|
|
|
|
new ShellPlugin({
|
|
|
|
onBuildStart: [
|
|
|
|
'php artisan vue-i18n:generate',
|
|
|
|
'php artisan ziggy:generate resources/assets/scripts/helpers/ziggy.js',
|
|
|
|
],
|
|
|
|
}),
|
2018-06-04 03:53:27 +02:00
|
|
|
new ExtractTextPlugin('bundle-[chunkhash].css', {
|
2018-06-04 03:46:27 +02:00
|
|
|
allChunks: true,
|
|
|
|
}),
|
2018-06-04 03:03:46 +02:00
|
|
|
new UglifyJsPLugin({
|
|
|
|
include: [
|
|
|
|
path.resolve(__dirname, 'resources/assets/scripts'),
|
|
|
|
],
|
|
|
|
parallel: 2,
|
|
|
|
sourceMap: false,
|
|
|
|
uglifyOptions: {
|
|
|
|
ecma: 5,
|
|
|
|
toplevel: true,
|
|
|
|
safari10: true,
|
|
|
|
}
|
|
|
|
}),
|
|
|
|
new ManifestPlugin(),
|
|
|
|
]
|
2018-03-31 06:58:38 +02:00
|
|
|
};
|