-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.common.js
109 lines (93 loc) · 3.18 KB
/
webpack.common.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
105
106
107
108
109
"use strict";
// This is the shared webpack configuration both production and development are based on.
const path = require("path");
const { VueLoaderPlugin } = require("vue-loader");
// const StyleLintPlugin = require("stylelint-webpack-plugin");
const HtmlWebpackPlugin = require("html-webpack-plugin");
module.exports = {
// Our main Webpack entry files. One for the main TypeScript app with Vue
// and one additionally for the Stylesheet entry point.
entry: [
"./src/index.ts",
"./src/style/style.scss"
],
resolve: {
extensions: [".js", ".ts", ".vue", ".scss"],
},
// Handle our output path so that it is usable by Cordova.
output: {
filename: "static/js/build.js",
path: path.resolve(__dirname, "./www/")
},
module: {
rules: [
{ // Compile TypeScript files using Babel.
test: /\.tsx?$/,
exclude: /node_modules/,
use: [
"babel-loader",
{
loader: "ts-loader",
options: {
transpileOnly: true
}
}
]
},
{ // Load Vue.js files into the bundle. Split off their stlye components.
test: /\.vue$/,
loader: "vue-loader",
options: {
loaders: {
ts: "babel-loader!ts-loader!tslint-loader"
}
}
},
{ // Basic loaders to handle included libraries" JavaScript.
test: /\.(js|jsx)$/,
exclude: /node_modules/,
loader: "babel-loader"
},
{ // Handle imported stylesheets as well as Vue style segments.
test: /\.css$/,
use: [
"style-loader",
"css-loader",
"sass-loader"
]
},
{ // Load in static assets required by modules.
test: /\.(png|jpe?g|gif|svg|woff|woff2|eot|ttf)$/,
loader: "file-loader",
options: {
name: "static/[name].[ext]"
}
}
]
},
plugins: [
// Our main Vue loader plugin.
new VueLoaderPlugin(),
// Disabled until stylint-webpack-plugin gets support for ^9.0.0
// new StyleLintPlugin({
// configFile: ".stylelintrc",
// files: "./**/*.s?(a|c)ss",
// syntax: "scss"
// }),
// Generate a webpack compatible HTML entry file from our template.
new HtmlWebpackPlugin({
template: "src/index.template.html",
inject: true,
minify: {
removeComments: true,
collapseWhitespace: true,
removeAttributeQuotes: true
}
})
],
performance: {
// This value controls whether size limits are shown. Doesn't make too
// much sense in the context of the app. Use "warning" or "error" if you want.
hints: false
}
};