UNPKG

1.23 kBJavaScriptView Raw
1"use strict";
2
3var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
4
5var _path = _interopRequireDefault(require("path"));
6
7var _checkSetup = require("@sharyn/check-setup");
8
9var _wdsUtil = require("./wds-util");
10
11/* eslint-disable import/no-extraneous-dependencies, global-require */
12// flow-disable-next-line
13var 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
36if ((0, _checkSetup.hasPackage)('compression-webpack-plugin')) {
37 // flow-disable-next-line
38 var CompressionPlugin = require('compression-webpack-plugin');
39
40 config.plugins.push(new CompressionPlugin());
41}
42
43if (_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
53module.exports = config;
\No newline at end of file