-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathpreact.config.js
More file actions
35 lines (30 loc) · 1.07 KB
/
preact.config.js
File metadata and controls
35 lines (30 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
const pkg = require("./package.json");
const webpack = require("webpack");
const preactCliSwPrecachePlugin = require("preact-cli-sw-precache");
const path = require("path");
const envVars = require('preact-cli-plugin-env-vars')
export default {
webpack(config, env, helpers, options) {
// const loader = config.module.loaders.find(x => x.loader === 'babel-loader');
// loader.options.plugins.push('recharts');
if (env.isProd) {
config.devtool = false; // disable sourcemaps
loader.options.compact = true;
config.output.publicPath = "";
}
const { loader: cssLoader } =
helpers.getLoadersByName(config, 'css-loader')[0];
cssLoader.options.modules = false;
config.node.process = true
envVars(config, env, helpers);
const precacheConfig = {
importScripts: [
// assume this js file is written manually outside of webpack
{ filename: "assets/push-notifications.js" },
],
};
config = preactCliSwPrecachePlugin(config, precacheConfig);
return config;
},
};
require("./node_modules/postcss");