-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
80 lines (77 loc) · 2.95 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
// webpack.config.js
const webpack = require('webpack')
const CopyWebpackPlugin = require('copy-webpack-plugin');
const CleanWebpackPlugin = require('clean-webpack-plugin'); //installed via npm
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const path = require('path');
const adminConfig = {
context: __dirname,
entry: {
"admin": './sources/admin.js',
"techletter": './htdocs/js/techletter/techletter.js'
},
output: {
path: path.resolve(__dirname, 'htdocs/js_dist'),
filename: '[name].js'
},
plugins: [
new CleanWebpackPlugin([
path.resolve(__dirname, 'htdocs/assets/calendrier/'),
path.resolve(__dirname, 'htdocs/js_dist')
]),
new CopyWebpackPlugin([
{ from: path.resolve(__dirname, 'node_modules/tablefilter/dist') },
{ from: path.resolve(__dirname, 'node_modules/jquery/dist/jquery.min.js'), to: path.resolve(__dirname, 'htdocs/assets/calendrier/js/jquery.min.js') },
{ from: path.resolve(__dirname, 'node_modules/angular/lib/angular.min.js'), to: path.resolve(__dirname, 'htdocs/assets/calendrier/js/angular.min.js') },
{ from: path.resolve(__dirname, 'node_modules/bootstrap/dist/js/bootstrap.min.js'), to: path.resolve(__dirname, 'htdocs/assets/calendrier/js/bootstrap.min.js') },
{ from: path.resolve(__dirname, 'node_modules/bootswatch/yeti/bootstrap.min.css'), to: path.resolve(__dirname, 'htdocs/assets/calendrier/css/bootstrap.min.css') },
{ from: path.resolve(__dirname, 'node_modules/bootswatch/fonts/'), to: path.resolve(__dirname, 'htdocs/assets/calendrier/fonts/') },
{ from: path.resolve(__dirname, 'node_modules/notyf/dist/'), to: path.resolve(__dirname, 'htdocs/assets/techletter/') },
{ from: path.resolve(__dirname, 'node_modules/qr-scanner/qr-scanner.min.js'), to: path.resolve(__dirname, 'htdocs/assets/qr-scanner/qr-scanner.min.js') },
{ from: path.resolve(__dirname, 'node_modules/qr-scanner/qr-scanner-worker.min.js'), to: path.resolve(__dirname, 'htdocs/assets/qr-scanner/qr-scanner-worker.min.js') },
])
],
module: {
rules: [
{
test: /\.js$/,
include: path.resolve(__dirname, './'),
use: [{
loader: 'babel-loader',
options: {
presets: [
['es2015', { modules: false }]
]
}
}]
}
]
}
}
const siteConfig = {
context: __dirname,
entry: path.resolve(__dirname, 'htdocs/templates/site/scss/styles.scss'),
output: {
path: path.resolve(__dirname, 'htdocs/templates/site/css'),
filename: 'styles.css',
},
plugins: [
new ExtractTextPlugin('styles.css'),
],
module: {
rules: [
{
test: /\.scss$/,
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: ['css-loader?url=false', 'sass-loader'],
}),
},
{
test: /\.(ttf|eot|svg|gif|png|jpg)$/,
loader: 'file-loader',
}
]
}
}
module.exports = [adminConfig, siteConfig]