UNPKG

1.29 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 resolve: {
32 alias: {
33 joi: 'joi-browser'
34 }
35 },
36 performance: {
37 hints: false
38 }
39};
40
41if ((0, _checkSetup.hasPackage)('compression-webpack-plugin')) {
42 // flow-disable-next-line
43 var CompressionPlugin = require('compression-webpack-plugin');
44
45 config.plugins.push(new CompressionPlugin());
46}
47
48if (_wdsUtil.WDS_PORT) {
49 config.output.publicPath = "http://localhost:".concat(_wdsUtil.WDS_PORT, "/static/");
50 config.devServer = {
51 port: _wdsUtil.WDS_PORT,
52 headers: {
53 'Access-Control-Allow-Origin': '*'
54 }
55 };
56}
57
58module.exports = config;
\No newline at end of file