This repository has been archived by the owner on Mar 19, 2023. It is now read-only.
/
webpack.config.js
67 lines (66 loc) · 2.15 KB
/
webpack.config.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
const CleanWebpackPlugin = require('clean-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const ManifestPlugin = require('webpack-manifest-plugin');
const Path = require('path');
module.exports = {
context: Path.join(__dirname, './Resources/assets'),
devtool: "source-map",
entry: {
app: [
'./javascript/app.js', './scss/theme.scss'
]
},
output: {
path: Path.join(__dirname, './Resources/public/build'),
publicPath: '/bundles/wearejustsonatatheme/build/',
filename: '[name].[hash].js'
},
resolve: {
modules: [
Path.resolve('./node_modules')
]
},
module: {
rules: [
{
test: /\.(jpe?g|png|gif|svg|woff|woff2|ttf|otf|eot)$/i,
loader: 'file-loader?hash=sha512&digest=hex&name=[name].[hash].[ext]'
},
{
test: /.js$/,
loader: 'babel-loader?presets[]=es2015-ie',
exclude: /node_modules|@wearejust/
},
{
test: /\.scss$/,
loaders: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: [
{ loader: "css-loader", options: { sourceMap: true } },
{
loader: 'postcss-loader', options: {
sourceMap: true,
ctx: {
autoprefixer: {
browsers: ['last 4 versions']
}
}
}
},
{ loader: "sass-loader", options: { sourceMap: true } }
],
}),
},
]
},
plugins: [
new CleanWebpackPlugin(['public/build/*']),
new ExtractTextPlugin({
filename: '[name].[hash].css',
allChunks: true,
}),
new ManifestPlugin({
basePath: 'bundles/wearejustsonatatheme/build/'
})
]
};