-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
104 lines (99 loc) · 2.42 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const BrowserSyncPlugin = require('browser-sync-webpack-plugin');
var path = require('path');
const appname = 'friendlyrobot';
// change these variables to fit your project
const publicPath = './theme/dist';
const jsPath= './theme/src/js';
const cssPath = './theme/src/scss';
const outputPath = 'theme/dist';
const localDomain = 'http://localhost/' + appname;
const entryPoints = {
// 'app' is the output name, people commonly use 'bundle'
// you can have more than 1 entry point
[appname + "_footer"] : jsPath + "/footer.js",
[appname + "_js"] : jsPath + "/app.js",
[appname] : cssPath + "/style.scss"
};
module.exports = {
entry: entryPoints,
output: {
path: path.resolve(__dirname, outputPath),
filename: 'js/[name].js',
},
devtool: 'inline-source-map',
plugins: [
new MiniCssExtractPlugin({
filename:'/css/[name].css',
}),
// Uncomment this if you want to use CSS Live reload
/*
new BrowserSyncPlugin({
proxy: localDomain,
files: [ outputPath + '/*.css' ],
injectCss: true,
}, { reload: false, }),
*/
],
module: {
rules: [
{
//test: /\.m?js$/,
test: /\.(js|mjs|jsx|ts|tsx)$/,
exclude: /(node_modules|bower_components)/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env']
}
}
},
/*
{
test: /\.s?[c]ss$/i,
use: [
MiniCssExtractPlugin.loader,
'css-loader',
'sass-loader'
]
},
*/
{
test: /\.(sa|sc|c)ss$/,
use: [
// MiniCssExtractPlugin.loader,
MiniCssExtractPlugin.loader,
'css-loader',
'sass-loader'
]
},
/*
{
test: /\.sass$/i,
use: [
MiniCssExtractPlugin.loader,
'css-loader',
{
loader: 'sass-loader',
options: {
url: false,
sourceMap: true,
sassOptions: { indentedSyntax: true }
}
}
]
},
*/
{
test: /\.(jpg|jpeg|png|gif|woff|woff2|eot|ttf|svg)$/i,
loader: 'file-loader',
options:{
name: "[name].[ext]",
outputPath: "img/",
useRelativePaths: true,
esModule: false,
}
}
]
}
};