This repository has been archived by the owner on Aug 23, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathwebpack.config.babel.js
75 lines (69 loc) · 2.17 KB
/
webpack.config.babel.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
import path from 'path';
import HtmlWebpackPlugin from 'html-webpack-plugin';
import CleanWebpackPlugin from 'clean-webpack-plugin';
import CopyWebpackPlugin from 'copy-webpack-plugin';
import { name, description, version } from'./package.json';
import merge from 'webpack-merge';
import baseConfig from 'create-plesk-app/lib/webpack/config';
const output = path.resolve(__dirname, 'dist');
module.exports = (env = {}) => merge(baseConfig(env), {
mode: env.dev ? 'development' : 'production',
entry: './src/frontend/index.js',
output: {
filename: 'htdocs/bundle.js',
path: output,
libraryTarget: 'amd',
},
module: {
rules: [
{
test: /\.js$/i,
exclude: /node_modules/,
loader: 'babel-loader',
},
{
test: /\.(png|gif|svg|jpg|woff|woff2)$/i,
loader: 'file-loader',
options: {
name: '[name].[ext]?[hash]',
outputPath: 'htdocs/images/',
},
},
],
},
plugins: [
new CleanWebpackPlugin(output),
new CopyWebpackPlugin([
{
from: path.resolve(__dirname, './src/htdocs'),
to: path.resolve(output, 'htdocs'),
},
]),
new CopyWebpackPlugin([
{
from: path.resolve(__dirname, './node_modules/xterm/dist/xterm.css'),
to: path.resolve(output, 'htdocs/xterm.css'),
},
]),
new CopyWebpackPlugin([
{
from: path.resolve(__dirname, './src/plib'),
to: path.resolve(output, 'plib'),
ignore: [ 'vendor/plesk/pm-api-stubs/**/*', 'vendor/plesk/zf1/**/*' ],
},
]),
new HtmlWebpackPlugin({
filename: 'meta.xml',
template: 'src/meta.xml',
inject: false,
templateParameters: {
id: name,
name: description,
version,
},
}),
],
externals: {
'@plesk/ui-library': { amd: 'plesk-ui-library' },
},
});