-
Notifications
You must be signed in to change notification settings - Fork 4
/
webpack.vue.js
77 lines (76 loc) · 2.46 KB
/
webpack.vue.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
const path = require("path");
const webpack = require("webpack");
const { BundleAnalyzerPlugin } = require("webpack-bundle-analyzer");
const CompressionPlugin = require("compression-webpack-plugin");
const BrotliPlugin = require("brotli-webpack-plugin");
module.exports = {
// entry point of our application
entry: ["./src/bulma/index.js"],
// where to place the compiled bundle
output: {
path: path.join(__dirname, "/public/js/bulma"),
filename: "bulma-site.js"
},
module: {
// `loaders` is an array of loaders to use.
// here we are only configuring vue-loader
loaders: [
{
test: /\.tpl$/,
loader: "raw-loader"
},
{
test: /\.vue$/, // a regex for matching all files that end in `.vue`
loader: "vue-loader", // loader to use for matched files,
options: {
loaders: {
scss: "vue-style-loader!css-loader!sass-loader",
sass: "vue-style-loader!css-loader!sass-loader?indentedSyntax"
}
}
},
{
test: /\.js$/,
exclude: /(node_modules|bower_components)/,
// include: /node_modules[/\\]vue-paginate/,
loader: "babel-loader",
options: {
presets: [["env", { modules: false, loose: true }]],
plugins: ["transform-runtime"]
}
},
// maybe its load too much CSS?
{ test: /\.css$/, loader: "style-loader!css-loader" },
{
test: /\.s(c|a)ss$/,
use: [{ loader: "style-loader" }, { loader: "css-loader" }, { loader: "sass-loader" }]
},
{
test: /\.(woff(2)?|ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: "file-loader",
query: {
name: "assets/[name].[ext]",
publicPath: "/static-jude/js/bulma/"
}
}
]
},
resolve: { alias: { vue$: path.join(__dirname, "node_modules/vue/dist/vue.js") }},
plugins: [
new webpack.ContextReplacementPlugin(/moment[/\\]locale$/, /en-gb/),
new webpack.ContextReplacementPlugin(/brace[/\\]theme$/, /github/),
new webpack.ContextReplacementPlugin(/brace[/\\]mode$/, /(c_cpp|java|python)/),
new webpack.optimize.UglifyJsPlugin(),
new CompressionPlugin({
asset: "[path].gz[query]",
algorithm: "gzip",
test: /\.(js|html|css|svg|woff(2)?|ttf|eot)$/,
threshold: 10 * 1024
}),
new BrotliPlugin({
asset: "[path].br[query]",
test: /\.(js|html|css|svg|woff(2)?|ttf|eot)$/,
threshold: 10 * 1024
})
]
};