Skip to content

Commit 8673a06

Browse files
committed
Remove gulp, move entirely to webpack
1 parent e84d2d6 commit 8673a06

File tree

2 files changed

+41
-109
lines changed

2 files changed

+41
-109
lines changed

gulpfile.js

Lines changed: 0 additions & 100 deletions
This file was deleted.

webpack.config.js

Lines changed: 41 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
const path = require('path');
2+
const CleanPlugin = require('clean-webpack-plugin');
3+
const ExtractTextPlugin = require('extract-text-webpack-plugin');
24
const ManifestPlugin = require('webpack-manifest-plugin');
5+
const ShellPlugin = require('webpack-shell-plugin');
36
const UglifyJsPLugin = require('uglifyjs-webpack-plugin');
47

58
module.exports = {
@@ -8,12 +11,13 @@ module.exports = {
811
performance: {
912
hints: false,
1013
},
11-
entry: {
12-
bundle: './resources/assets/scripts/app.js',
13-
},
14+
// Passing an array loads them all but only exports the last.
15+
entry: ['./resources/assets/styles/main.css', './resources/assets/scripts/app.js'],
1416
output: {
15-
path: path.resolve(__dirname, 'public/assets/scripts'),
16-
filename: 'bundle-[chunkhash].js',
17+
path: path.resolve(__dirname, 'public/assets'),
18+
filename: 'bundle-[chunkhash].min.js',
19+
publicPath: '/assets/',
20+
crossOriginLoading: 'anonymous',
1721
},
1822
module: {
1923
rules: [
@@ -34,11 +38,29 @@ module.exports = {
3438
include: [
3539
path.resolve(__dirname, 'resources/assets/scripts'),
3640
],
37-
use: [{
38-
loader: 'babel-loader',
39-
options: {babelrc: true}
40-
}]
41+
loader: 'babel-loader',
4142
},
43+
{
44+
test: /\.css$/,
45+
include: [
46+
path.resolve(__dirname, 'resources/assets/styles'),
47+
],
48+
use: ExtractTextPlugin.extract({
49+
fallback: 'style-loader',
50+
use: ['css-loader', {
51+
loader: 'postcss-loader',
52+
options: {
53+
ident: 'postcss',
54+
plugins: [
55+
require('postcss-import'),
56+
require('postcss-preset-env')({stage: 0}),
57+
require('tailwindcss')('./tailwind.js'),
58+
require('autoprefixer'),
59+
]
60+
},
61+
}],
62+
}),
63+
}
4264
]
4365
},
4466
resolve: {
@@ -48,6 +70,16 @@ module.exports = {
4870
extensions: ['*', '.js', '.vue', '.json']
4971
},
5072
plugins: [
73+
new CleanPlugin(path.resolve(__dirname, 'public/assets')),
74+
new ShellPlugin({
75+
onBuildStart: [
76+
'php artisan vue-i18n:generate',
77+
'php artisan ziggy:generate resources/assets/scripts/helpers/ziggy.js',
78+
],
79+
}),
80+
new ExtractTextPlugin('bundle-[chunkhash].min.css', {
81+
allChunks: true,
82+
}),
5183
new UglifyJsPLugin({
5284
include: [
5385
path.resolve(__dirname, 'resources/assets/scripts'),

0 commit comments

Comments
 (0)