-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.frontend.blade.mix.js
89 lines (84 loc) · 2.12 KB
/
webpack.frontend.blade.mix.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
const path = require('path')
const mix = require('laravel-mix')
const CleanWebpackPlugin = require('clean-webpack-plugin')
const webpack = require('webpack')
require('dotenv').config()
const assetFolder = 'vendor/naraki/components'
const folderName = '6aa0e'
const publicPath = `public/${folderName}`
mix.js('resources/assets/app.js', 'js/app.js')
.sass('resources/assets/app.scss', 'css/app.css', {
includePaths: [
path.resolve(assetFolder + '/resources')
]
})
.sourceMaps()
.disableNotifications()
.setPublicPath(path.normalize(publicPath))
.options({
// autoprefixer: {
// options: {
// browsers: ['> 10%', 'last 6 versions', 'ff ESR', 'opera >= 12', 'safari >= 5', 'ios >= 8', 'ie >= 8'],
// }
// },
fileLoaderDirs: {
fonts: '../fonts'
}
})
if (mix.inProduction()) {
mix.version()
mix.extract([
'vue',
'axios',
'jquery',
'popper.js',
'vue-i18n',
'sweetalert2',
'fontawesome'
])
}
mix.browserSync({
proxy: process.env.APP_URL,
browser: 'chrome',
notify: false,
files: [
'app/**/*',
assetFolder + '/**/*'
]
})
mix.webpackConfig({
plugins: [
new CleanWebpackPlugin([
'js', 'css', 'fonts', 'mix-manifest.json'
], {
root: path.resolve(__dirname, publicPath),
exclude: 'vendor',
verbose: true,
dry: false
}),
new webpack.ProvidePlugin({
// '$': 'jquery',
// jQuery: 'jquery',
// // Popper: 'popper.js/dist/umd/popper',
// axios: 'axios/dist/axios.min.js',
// ResponsiveBootstrapToolkit: 'front_path/plugins/jquery/bootstrap-toolkit.js',
// swal: 'sweetalert2/dist/sweetalert2.min.js'
})
],
resolve: {
extensions: ['.js', '.json', '.vue'],
alias: {
'front_path': path.resolve(assetFolder + '/resources/frontend/js'),
'front_main_path': path.resolve('resources/assets'),
'back_path': path.resolve(assetFolder + '/resources/backend/js'),
'jquery': 'jquery/src/jquery'
},
modules: [
'node_modules'
]
},
output: {
chunkFilename: 'js/[name].[chunkhash].js',
publicPath: `/${folderName}/`
}
})