Skip to content

Commit a80180c

Browse files
clean
1 parent 4feaa96 commit a80180c

File tree

18 files changed

+187
-165
lines changed

18 files changed

+187
-165
lines changed

dev-tools/config/webpack.helpers.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,9 @@ exports.compose = (funcs) => {
77
return funcs[0]
88
}
99

10-
return funcs.reduce((a, b) => (...args) => a(b(...args)))
10+
return funcs.reduce(
11+
(a, b) =>
12+
(...args) =>
13+
a(b(...args))
14+
)
1115
}

dev-tools/config/webpack.module.optimize.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@ module.exports =
2525
},
2626
new CssMinimizerPlugin()
2727
],
28-
runtimeChunk: 'single',
28+
removeAvailableModules: false,
29+
removeEmptyChunks: false,
30+
splitChunks: false
31+
32+
/*
2933
splitChunks: {
3034
chunks: 'all',
3135
maxInitialRequests: Infinity,
@@ -44,5 +48,7 @@ module.exports =
4448
}
4549
}
4650
}
51+
52+
*/
4753
}
4854
})
Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
const path = require('path')
22

3-
module.exports = ({ config, isDevelopment = true }) => (webpackConfig) => ({
4-
...webpackConfig,
5-
output: {
6-
path: path.join(config.projectRoot, 'dist', config.dist.publicPath !== '/' ? config.dist.publicPath : ''),
7-
publicPath: isDevelopment ? '/' : config.dist.publicPath,
8-
filename: isDevelopment ? '[name].js' : path.posix.join('', `${config.dist.versionPath}js/[name].js`),
9-
chunkFilename: isDevelopment ? '[id].js' : path.posix.join('', `${config.dist.versionPath}js/[id].js`)
10-
}
11-
})
3+
module.exports =
4+
({ config, isDevelopment = true }) =>
5+
(webpackConfig) => ({
6+
...webpackConfig,
7+
output: {
8+
path: path.join(config.projectRoot, 'dist', config.dist.publicPath !== '/' ? config.dist.publicPath : ''),
9+
publicPath: isDevelopment ? '/' : config.dist.publicPath,
10+
filename: isDevelopment ? '[name].js' : path.posix.join('', `${config.dist.versionPath}js/[name].js`),
11+
chunkFilename: isDevelopment ? '[id].js' : path.posix.join('', `${config.dist.versionPath}js/[id].js`)
12+
}
13+
})
Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
const path = require('path')
22

3-
module.exports = ({ config }) => (webpackConfig) => ({
4-
...webpackConfig,
5-
resolve: {
6-
extensions: ['.ts', '.js', '.vue', '.json'],
7-
alias: {
8-
vue: 'vue/dist/vue.esm-bundler.js',
9-
'@': path.resolve(config.projectRoot, 'src')
10-
/*
11-
* You are running the esm-bundler build of vue-i18n.
12-
* It is recommended to configure your bundler to explicitly replace feature flag globals
13-
* with boolean literals to get proper tree-shaking in the final bundle.
14-
*/
3+
module.exports =
4+
({ config }) =>
5+
(webpackConfig) => ({
6+
...webpackConfig,
7+
resolve: {
8+
extensions: ['.ts', '.js', '.vue', '.json'],
9+
alias: {
10+
vue: 'vue/dist/vue.esm-bundler.js',
11+
'@': path.resolve(config.projectRoot, 'src')
12+
/*
13+
* You are running the esm-bundler build of vue-i18n.
14+
* It is recommended to configure your bundler to explicitly replace feature flag globals
15+
* with boolean literals to get proper tree-shaking in the final bundle.
16+
*/
17+
}
1518
}
16-
}
17-
})
19+
})

dev-tools/config/webpack.module.rules.js

Lines changed: 110 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -2,123 +2,125 @@ const MiniCssExtractPlugin = require('mini-css-extract-plugin')
22
const ImageMinimizerPlugin = require('image-minimizer-webpack-plugin')
33
const path = require('path')
44

5-
module.exports = ({ config, isDevelopment }) => (webpackConfig) => ({
6-
...webpackConfig,
7-
module: {
8-
rules: [
9-
isDevelopment
10-
? {
11-
test: /\.(s[ac]ss|css)$/,
12-
use: [
13-
'style-loader',
14-
'css-loader',
15-
'postcss-loader',
16-
{
17-
loader: 'sass-loader',
18-
options: {
19-
sassOptions: {
20-
indentWidth: 4,
21-
includePaths: []
5+
module.exports =
6+
({ config, isDevelopment }) =>
7+
(webpackConfig) => ({
8+
...webpackConfig,
9+
module: {
10+
rules: [
11+
isDevelopment
12+
? {
13+
test: /\.(s[ac]ss|css)$/,
14+
use: [
15+
'style-loader',
16+
'css-loader',
17+
'postcss-loader',
18+
{
19+
loader: 'sass-loader',
20+
options: {
21+
sassOptions: {
22+
indentWidth: 4,
23+
includePaths: []
24+
}
2225
}
2326
}
24-
}
25-
]
26-
}
27-
: {
28-
test: /\.(s[ac]ss|css)$/,
29-
use: [
30-
MiniCssExtractPlugin.loader,
31-
'css-loader',
32-
'postcss-loader',
33-
{
34-
loader: 'sass-loader',
35-
options: {
36-
sassOptions: {
37-
indentWidth: 4,
38-
includePaths: []
27+
]
28+
}
29+
: {
30+
test: /\.(s[ac]ss|css)$/,
31+
use: [
32+
MiniCssExtractPlugin.loader,
33+
'css-loader',
34+
'postcss-loader',
35+
{
36+
loader: 'sass-loader',
37+
options: {
38+
sassOptions: {
39+
indentWidth: 4,
40+
includePaths: []
41+
}
3942
}
4043
}
41-
}
42-
]
43-
},
44-
{
45-
test: /\.vue$/,
46-
loader: 'vue-loader'
47-
},
48-
{
49-
test: /\.js$/,
50-
exclude: /node_modules/,
51-
// use: ['babel-loader', 'eslint-loader']
44+
]
45+
},
46+
{
47+
test: /\.vue$/,
48+
loader: 'vue-loader'
49+
},
50+
{
51+
test: /\.js$/,
52+
exclude: /node_modules/,
53+
// use: ['babel-loader', 'eslint-loader']
5254

53-
use: [
54-
{
55-
loader: 'babel-loader',
55+
use: [
56+
{
57+
loader: 'babel-loader?cacheDirectory',
58+
options: {
59+
presets: ['@babel/preset-env']
60+
}
61+
}
62+
]
63+
},
64+
{
65+
test: /\.ts$/,
66+
exclude: /node_modules/,
67+
use: [
68+
{
69+
loader: 'babel-loader?cacheDirectory',
70+
options: { babelrc: true }
71+
},
72+
{
73+
loader: 'ts-loader',
74+
options: { appendTsSuffixTo: [/\.vue$/] }
75+
}
76+
]
77+
},
78+
{
79+
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
80+
use: {
81+
loader: 'file-loader',
5682
options: {
57-
presets: ['@babel/preset-env']
83+
limit: 10000,
84+
name: path.posix.join(isDevelopment ? '' : config.dist.versionPath, 'fonts/[name].[ext]')
5885
}
5986
}
60-
]
61-
},
62-
{
63-
test: /\.ts$/,
64-
exclude: /node_modules/,
65-
use: [
66-
{
67-
loader: 'babel-loader',
68-
options: { babelrc: true }
69-
},
70-
{
71-
loader: 'ts-loader',
72-
options: { appendTsSuffixTo: [/\.vue$/] }
73-
}
74-
]
75-
},
76-
{
77-
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
78-
use: {
79-
loader: 'file-loader',
80-
options: {
81-
limit: 10000,
82-
name: path.posix.join(isDevelopment ? '' : config.dist.versionPath, 'fonts/[name].[ext]')
83-
}
84-
}
85-
},
86-
{
87-
test: /\.(?:ico|gif|png|jpg|jpeg|svg)$/i,
88-
type: 'asset/resource'
89-
},
90-
{
91-
test: /\.(ico|gif|png|jpg|jpeg|svg)$/i,
92-
use: [
93-
{
94-
loader: ImageMinimizerPlugin.loader,
95-
options: {
96-
severityError: 'warning', // Ignore errors on corrupted images
97-
minimizerOptions: {
98-
plugins: ['gifsicle']
87+
},
88+
{
89+
test: /\.(?:ico|gif|png|jpg|jpeg|svg)$/i,
90+
type: 'asset/resource'
91+
},
92+
{
93+
test: /\.(ico|gif|png|jpg|jpeg|svg)$/i,
94+
use: [
95+
{
96+
loader: ImageMinimizerPlugin.loader,
97+
options: {
98+
severityError: 'warning', // Ignore errors on corrupted images
99+
minimizerOptions: {
100+
plugins: ['gifsicle']
101+
}
99102
}
100103
}
101-
}
102-
]
103-
},
104-
{
105-
test: /\.svg$/,
106-
use: [
107-
{
108-
loader: 'file-loader'
109-
},
110-
{
111-
loader: 'svgo-loader',
112-
options: {
113-
multipass: true,
114-
js2svg: {
115-
indent: 2,
116-
pretty: true
104+
]
105+
},
106+
{
107+
test: /\.svg$/,
108+
use: [
109+
{
110+
loader: 'file-loader'
111+
},
112+
{
113+
loader: 'svgo-loader',
114+
options: {
115+
multipass: true,
116+
js2svg: {
117+
indent: 2,
118+
pretty: true
119+
}
117120
}
118121
}
119-
}
120-
]
121-
}
122-
]
123-
}
124-
})
122+
]
123+
}
124+
]
125+
}
126+
})
Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
11
const fs = require('fs')
22

3-
module.exports = ({ config }) => (webpackConfig) => ({
4-
...webpackConfig,
5-
devServer: {
6-
https: config.devServer.useHttps,
7-
clientLogLevel: 'info',
8-
historyApiFallback: true,
9-
hot: true,
10-
compress: true,
11-
host: 'localhost',
12-
port: config.devServer.port,
13-
disableHostCheck: true,
14-
open: false,
15-
overlay: {
16-
warning: false,
17-
errors: true
3+
module.exports =
4+
({ config }) =>
5+
(webpackConfig) => ({
6+
...webpackConfig,
7+
devServer: {
8+
https: config.devServer.useHttps,
9+
clientLogLevel: 'info',
10+
historyApiFallback: true,
11+
hot: true,
12+
compress: true,
13+
host: '0.0.0.0',
14+
port: config.devServer.port,
15+
disableHostCheck: true,
16+
open: false,
17+
overlay: {
18+
warning: false,
19+
errors: true
20+
}
1821
}
19-
}
20-
})
22+
})

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<head>
55
<meta charset="UTF-8" />
66
<meta name="google" content="notranslate" />
7-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
88
<title>Vue Unknown</title>
99
<script>var webpackPublicPath = <%= JSON.stringify(htmlWebpackPlugin.options.publicPath) %>;</script>
1010
</head>

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "vue-unknown",
3-
"version": "1.1.0",
4-
"description": "A Vue Framework",
3+
"version": "0.8.0",
4+
"description": "A Vue Skeleton Framework",
55
"author": "Andrea Giuffrida [email protected]",
66
"homepage": "https://github.com/the-unknown-code/vue-unknown",
77
"scripts": {
@@ -85,6 +85,7 @@
8585
"git-revision-webpack-plugin": "^3.0.6",
8686
"html-webpack-plugin": "^5.3.1",
8787
"http": "^0.0.1-security",
88+
"image-minimizer-webpack-plugin": "^3.2.3",
8889
"imagemin-gifsicle": "^7.0.0",
8990
"imagemin-jpegtran": "^7.0.0",
9091
"imagemin-optipng": "^8.0.0",

0 commit comments

Comments
 (0)