1 | "use strict";
|
2 |
|
3 | var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
|
4 |
|
5 | var _path = _interopRequireDefault(require("path"));
|
6 |
|
7 | var _checkSetup = require("@sharyn/check-setup");
|
8 |
|
9 | var _wdsUtil = require("./wds-util");
|
10 |
|
11 |
|
12 |
|
13 | var config = {
|
14 | entry: './src/_client/client.js',
|
15 | output: {
|
16 | filename: "js/bundle.js",
|
17 | chunkFilename: '[name].[chunkhash].js',
|
18 | path: _path.default.resolve('dist'),
|
19 | publicPath: '/static/'
|
20 | },
|
21 | module: {
|
22 | rules: [{
|
23 | test: /\.js$/,
|
24 | exclude: /node_modules/,
|
25 | use: {
|
26 | loader: 'babel-loader'
|
27 | }
|
28 | }]
|
29 | },
|
30 | plugins: [],
|
31 | performance: {
|
32 | hints: false
|
33 | }
|
34 | };
|
35 |
|
36 | if ((0, _checkSetup.hasPackage)('compression-webpack-plugin')) {
|
37 |
|
38 | var CompressionPlugin = require('compression-webpack-plugin');
|
39 |
|
40 | config.plugins.push(new CompressionPlugin());
|
41 | }
|
42 |
|
43 | if (_wdsUtil.WDS_PORT) {
|
44 | config.output.publicPath = "http://localhost:".concat(_wdsUtil.WDS_PORT, "/static/");
|
45 | config.devServer = {
|
46 | port: _wdsUtil.WDS_PORT,
|
47 | headers: {
|
48 | 'Access-Control-Allow-Origin': '*'
|
49 | }
|
50 | };
|
51 | }
|
52 |
|
53 | module.exports = config; |
\ | No newline at end of file |