diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/service/wifi/webpack.config.js	Tue Dec 17 23:16:53 2019 -0800
@@ -0,0 +1,70 @@
+const glob = require('glob');
+const jest = require('jest');
+const path = require("path");
+const PnpWebpackPlugin = require('pnp-webpack-plugin');
+
+const base = {
+    devtool: 'source-map',
+    module: {
+        rules: [
+            {
+                test: /\.ts$/,
+                loader: require.resolve('ts-loader'),
+                options: PnpWebpackPlugin.tsLoaderOptions({})
+            },
+            {
+                test: /\.css$/i,
+                use: ['file-loader']
+            },
+        ]
+    },
+    resolve: {
+        extensions: [".ts", ".js"],
+        plugins: [
+            PnpWebpackPlugin,
+        ],
+        alias: {
+            'streamed-graph': '/my/proj/streamed-graph'
+        },
+        modules: ['/tmp/sgpath2'],
+    },
+    resolveLoader: { plugins: [PnpWebpackPlugin.moduleLoader(module),], }
+};
+
+function outputToBundle(bundleName) {
+    return {
+        filename: bundleName,
+        path: path.resolve(__dirname, 'build'),
+        publicPath: '/build/'
+    };
+}
+
+module.exports = [
+    Object.assign({
+        name: "main",
+        entry: ['./src/wifi.ts'],
+        output: outputToBundle('wifi.bundle.js'),
+        devServer: {
+            port: 8082,
+            publicPath: '/build/',
+            contentBase: __dirname
+        }
+    }, base),
+    Object.assign({
+        name: "test",
+        entry: glob.sync('src/**/*.test.ts').map((p) => './' + p),
+        output: outputToBundle('test.bundle.js'),
+        plugins: [
+            {
+                apply: (compiler) => {
+                    compiler.hooks.afterEmit.tap('AfterEmitPlugin', (compilation) => {
+                        jest.run([
+                            '--detectOpenHandles', // not just to debug; having this quiets a jest error
+                            '--testRegex', 'test.bundle.js', 'build/test.bundle.js']);
+                    });
+                }
+            }
+        ]
+    }, base)
+];
+