Repository navigation
Expand file tree
/
Copy pathwebpack.config.js
More file actions
102 lines (101 loc) · 2.78 KB
/
Copy pathwebpack.config.js
File metadata and controls
102 lines (101 loc) · 2.78 KB
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
const path = require('path');
const webpack = require('webpack')
const config = require('./src/app/config/config')
const pkg = require('./package.json')
const iframeConfig = require('./src/app/config/iframe')
const VueLoaderPlugin = require('vue-loader/lib/plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')
module.exports = {
// mode: 'production',
entry: './src/app/index.js',
output: {
path: path.resolve(__dirname, 'dist'),
filename: pkg.name.toLowerCase() + '.js',
// publicPath: '/assets/',
library: pkg.name,
libraryExport: 'default',
libraryTarget: 'umd'
},
module: {
rules: [
{
enforce: 'pre',
test: /\.(js|vue)$/,
loader: 'eslint-loader',
exclude: '/node_modules/'
},
{
test: /\.js$/,
exclude: '/node_modules/',
loader: 'babel-loader',
options: {
// presets: ['es2015']
presets: ['@babel/preset-env']
}
},
{
test: /\.vue$/,
loader: 'vue-loader'
},
// {
// test: /\.html$/,
// loader: 'htmllint-loader',
// exclude: '/node_modules/',
// },
{
test: /\.css$/,
use: ['vue-style-loader', 'style-loader', 'css-loader'],
},
],
},
resolve: {
modules: ['node_modules'],
extensions: ['.js', '.json', '.jsx', '.css'],
alias: {
App: path.resolve(__dirname, 'src/app/'),
Editor: path.resolve(__dirname, 'src/editor/'),
Components: path.resolve(__dirname, 'src/editor/components')
}
},
performance: {
hints: 'warning', // enum
maxAssetSize: 200000, // int (in bytes),
maxEntrypointSize: 400000, // int (in bytes)
assetFilter: function(assetFilename) {
return assetFilename.endsWith('.css') || assetFilename.endsWith('.js');
}
},
devtool: 'source-map',
context: __dirname,
target: 'web',
// stats: 'errors-only',
// stats: 'detailed',
stats: 'normal',
plugins: [
new webpack.BannerPlugin(config.banner),
new VueLoaderPlugin(),
new HtmlWebpackPlugin({
title: pkg.name,
filename: 'index.html', //default
templateParameters: {
'author': pkg.author,
'desc': pkg.description,
'maincss': config.maincss,
'fontawesomecss': config.fontawesomecss,
'fontawesomejs': config.fontawesomejs,
},
inject: 'head',
template: 'src/app/config/webpack-template.html'
}),
new HtmlWebpackPlugin({
title: iframeConfig.title,
filename: 'iframe.html',
templateParameters: {
'cssframework': iframeConfig.cssframework,
'iframecss': iframeConfig.iframecss
},
inject: false,
template: 'src/app/config/webpack-iframe-template.html'
})
]
}