Mercurial > code > home > repos > homeauto
annotate service/wifi/webpack.config.js @ 1464:32d134dbfb1e
start ts config files, but this doesn't share the streamed-graph code properly yet
Ignore-this: ef4e6fdf3369939b062caa5fdc2788e9
darcs-hash:e30e71ea5e8e9958c254c9210cdccde7a74b96bb
author | drewp <drewp@bigasterisk.com> |
---|---|
date | Tue, 17 Dec 2019 23:16:53 -0800 |
parents | |
children |
rev | line source |
---|---|
1464
32d134dbfb1e
start ts config files, but this doesn't share the streamed-graph code properly yet
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
1 const glob = require('glob'); |
32d134dbfb1e
start ts config files, but this doesn't share the streamed-graph code properly yet
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
2 const jest = require('jest'); |
32d134dbfb1e
start ts config files, but this doesn't share the streamed-graph code properly yet
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
3 const path = require("path"); |
32d134dbfb1e
start ts config files, but this doesn't share the streamed-graph code properly yet
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
4 const PnpWebpackPlugin = require('pnp-webpack-plugin'); |
32d134dbfb1e
start ts config files, but this doesn't share the streamed-graph code properly yet
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
5 |
32d134dbfb1e
start ts config files, but this doesn't share the streamed-graph code properly yet
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
6 const base = { |
32d134dbfb1e
start ts config files, but this doesn't share the streamed-graph code properly yet
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
7 devtool: 'source-map', |
32d134dbfb1e
start ts config files, but this doesn't share the streamed-graph code properly yet
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
8 module: { |
32d134dbfb1e
start ts config files, but this doesn't share the streamed-graph code properly yet
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
9 rules: [ |
32d134dbfb1e
start ts config files, but this doesn't share the streamed-graph code properly yet
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
10 { |
32d134dbfb1e
start ts config files, but this doesn't share the streamed-graph code properly yet
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
11 test: /\.ts$/, |
32d134dbfb1e
start ts config files, but this doesn't share the streamed-graph code properly yet
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
12 loader: require.resolve('ts-loader'), |
32d134dbfb1e
start ts config files, but this doesn't share the streamed-graph code properly yet
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
13 options: PnpWebpackPlugin.tsLoaderOptions({}) |
32d134dbfb1e
start ts config files, but this doesn't share the streamed-graph code properly yet
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
14 }, |
32d134dbfb1e
start ts config files, but this doesn't share the streamed-graph code properly yet
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
15 { |
32d134dbfb1e
start ts config files, but this doesn't share the streamed-graph code properly yet
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
16 test: /\.css$/i, |
32d134dbfb1e
start ts config files, but this doesn't share the streamed-graph code properly yet
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
17 use: ['file-loader'] |
32d134dbfb1e
start ts config files, but this doesn't share the streamed-graph code properly yet
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
18 }, |
32d134dbfb1e
start ts config files, but this doesn't share the streamed-graph code properly yet
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
19 ] |
32d134dbfb1e
start ts config files, but this doesn't share the streamed-graph code properly yet
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
20 }, |
32d134dbfb1e
start ts config files, but this doesn't share the streamed-graph code properly yet
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
21 resolve: { |
32d134dbfb1e
start ts config files, but this doesn't share the streamed-graph code properly yet
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
22 extensions: [".ts", ".js"], |
32d134dbfb1e
start ts config files, but this doesn't share the streamed-graph code properly yet
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
23 plugins: [ |
32d134dbfb1e
start ts config files, but this doesn't share the streamed-graph code properly yet
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
24 PnpWebpackPlugin, |
32d134dbfb1e
start ts config files, but this doesn't share the streamed-graph code properly yet
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
25 ], |
32d134dbfb1e
start ts config files, but this doesn't share the streamed-graph code properly yet
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
26 alias: { |
32d134dbfb1e
start ts config files, but this doesn't share the streamed-graph code properly yet
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
27 'streamed-graph': '/my/proj/streamed-graph' |
32d134dbfb1e
start ts config files, but this doesn't share the streamed-graph code properly yet
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
28 }, |
32d134dbfb1e
start ts config files, but this doesn't share the streamed-graph code properly yet
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
29 modules: ['/tmp/sgpath2'], |
32d134dbfb1e
start ts config files, but this doesn't share the streamed-graph code properly yet
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
30 }, |
32d134dbfb1e
start ts config files, but this doesn't share the streamed-graph code properly yet
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
31 resolveLoader: { plugins: [PnpWebpackPlugin.moduleLoader(module),], } |
32d134dbfb1e
start ts config files, but this doesn't share the streamed-graph code properly yet
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
32 }; |
32d134dbfb1e
start ts config files, but this doesn't share the streamed-graph code properly yet
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
33 |
32d134dbfb1e
start ts config files, but this doesn't share the streamed-graph code properly yet
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
34 function outputToBundle(bundleName) { |
32d134dbfb1e
start ts config files, but this doesn't share the streamed-graph code properly yet
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
35 return { |
32d134dbfb1e
start ts config files, but this doesn't share the streamed-graph code properly yet
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
36 filename: bundleName, |
32d134dbfb1e
start ts config files, but this doesn't share the streamed-graph code properly yet
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
37 path: path.resolve(__dirname, 'build'), |
32d134dbfb1e
start ts config files, but this doesn't share the streamed-graph code properly yet
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
38 publicPath: '/build/' |
32d134dbfb1e
start ts config files, but this doesn't share the streamed-graph code properly yet
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
39 }; |
32d134dbfb1e
start ts config files, but this doesn't share the streamed-graph code properly yet
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
40 } |
32d134dbfb1e
start ts config files, but this doesn't share the streamed-graph code properly yet
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
41 |
32d134dbfb1e
start ts config files, but this doesn't share the streamed-graph code properly yet
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
42 module.exports = [ |
32d134dbfb1e
start ts config files, but this doesn't share the streamed-graph code properly yet
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
43 Object.assign({ |
32d134dbfb1e
start ts config files, but this doesn't share the streamed-graph code properly yet
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
44 name: "main", |
32d134dbfb1e
start ts config files, but this doesn't share the streamed-graph code properly yet
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
45 entry: ['./src/wifi.ts'], |
32d134dbfb1e
start ts config files, but this doesn't share the streamed-graph code properly yet
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
46 output: outputToBundle('wifi.bundle.js'), |
32d134dbfb1e
start ts config files, but this doesn't share the streamed-graph code properly yet
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
47 devServer: { |
32d134dbfb1e
start ts config files, but this doesn't share the streamed-graph code properly yet
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
48 port: 8082, |
32d134dbfb1e
start ts config files, but this doesn't share the streamed-graph code properly yet
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
49 publicPath: '/build/', |
32d134dbfb1e
start ts config files, but this doesn't share the streamed-graph code properly yet
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
50 contentBase: __dirname |
32d134dbfb1e
start ts config files, but this doesn't share the streamed-graph code properly yet
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
51 } |
32d134dbfb1e
start ts config files, but this doesn't share the streamed-graph code properly yet
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
52 }, base), |
32d134dbfb1e
start ts config files, but this doesn't share the streamed-graph code properly yet
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
53 Object.assign({ |
32d134dbfb1e
start ts config files, but this doesn't share the streamed-graph code properly yet
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
54 name: "test", |
32d134dbfb1e
start ts config files, but this doesn't share the streamed-graph code properly yet
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
55 entry: glob.sync('src/**/*.test.ts').map((p) => './' + p), |
32d134dbfb1e
start ts config files, but this doesn't share the streamed-graph code properly yet
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
56 output: outputToBundle('test.bundle.js'), |
32d134dbfb1e
start ts config files, but this doesn't share the streamed-graph code properly yet
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
57 plugins: [ |
32d134dbfb1e
start ts config files, but this doesn't share the streamed-graph code properly yet
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
58 { |
32d134dbfb1e
start ts config files, but this doesn't share the streamed-graph code properly yet
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
59 apply: (compiler) => { |
32d134dbfb1e
start ts config files, but this doesn't share the streamed-graph code properly yet
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
60 compiler.hooks.afterEmit.tap('AfterEmitPlugin', (compilation) => { |
32d134dbfb1e
start ts config files, but this doesn't share the streamed-graph code properly yet
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
61 jest.run([ |
32d134dbfb1e
start ts config files, but this doesn't share the streamed-graph code properly yet
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
62 '--detectOpenHandles', // not just to debug; having this quiets a jest error |
32d134dbfb1e
start ts config files, but this doesn't share the streamed-graph code properly yet
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
63 '--testRegex', 'test.bundle.js', 'build/test.bundle.js']); |
32d134dbfb1e
start ts config files, but this doesn't share the streamed-graph code properly yet
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
64 }); |
32d134dbfb1e
start ts config files, but this doesn't share the streamed-graph code properly yet
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
65 } |
32d134dbfb1e
start ts config files, but this doesn't share the streamed-graph code properly yet
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
66 } |
32d134dbfb1e
start ts config files, but this doesn't share the streamed-graph code properly yet
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
67 ] |
32d134dbfb1e
start ts config files, but this doesn't share the streamed-graph code properly yet
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
68 }, base) |
32d134dbfb1e
start ts config files, but this doesn't share the streamed-graph code properly yet
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
69 ]; |
32d134dbfb1e
start ts config files, but this doesn't share the streamed-graph code properly yet
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
70 |