-
-
Notifications
You must be signed in to change notification settings - Fork 136
/
webpack.config.js
85 lines (82 loc) · 2.3 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
const CopyWebpackPlugin = require('copy-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const webpack = require('webpack');
const path = require("path");
module.exports = {
mode: 'development',
context: path.resolve(__dirname, 'app/assets'),
entry: {
//teambuilder: "./javascript/teambuilder.js",
frontend: "./javascript/index.js"
},
output: {
path: path.resolve(__dirname, "public/"),
filename: "javascript/[name].js"
},
devtool: "source-map",
module: {
rules: [
{
test: /\.css$/,
use: [
{ loader: MiniCssExtractPlugin.loader },
{ loader: "style-loader" },
{ loader: "css-loader" },
{ loader: "resolve-url-loader" },
],
},
{
test: /\.scss$/,
use: [
{ loader: MiniCssExtractPlugin.loader,options: {
publicPath: './',
reloadAll: true,
},
},
{ loader: "css-loader" },
{ loader: "sass-loader" },
{ loader: "resolve-url-loader" },
]
,
},
{
test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
use: "file-loader?publicPath=../&name=./files/[hash].[ext]"
},
{
test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/,
use: "url-loader?publicPath=../&name=./files/[hash].[ext]&limit=10000&mimetype=application/font-woff"
},
{
test: /\.png$/,
use: "url-loader?publicPath=../&name=./files/[hash].[ext]&limit=10000&mimetype=image/png"
}
]
},
plugins: [
new CopyWebpackPlugin([{
context: __dirname,
from: "node_modules/jquery/dist/jquery.min.js",
to: "javascript"
}, {
context: __dirname,
from: "node_modules/tether/dist/js/tether.min.js",
to: "javascript"
}, {
from: "javascript/preload.js", to: "javascript"
}, {
from: "javascript/settings.js", to: "javascript"
}]),
new webpack.ProvidePlugin({
$: 'jquery', jquery: 'jquery', jQuery: 'jquery',
"window.Tether": 'tether', "Popper": "popper.js"
}),
//new MiniCssExtractPlugin("assets/stylesheets/styles.css")
new MiniCssExtractPlugin({
filename: '/app/assets/stylesheets/styles.css',
})
],
externals: {
jquery: 'jQuery'
}
};