-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpreact.config.js
76 lines (64 loc) · 1.98 KB
/
preact.config.js
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
const webpack = require('webpack');
const path = require('path');
//const flowPlugin = require('preact-cli-plugin-flow');
//const swPrecachePlugin = require('preact-cli-sw-precache');
//const fastAsyncPlugin = require('preact-cli-plugin-fast-async');
//const criticalCssPlugin = require('preact-cli-plugin-critical-css');
// const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
// const HtmlWebpackPlugin = require('html-webpack-plugin');
export default function(config, env, helpers) {
// LOADERS ---
config.module.rules.push({
enforce: 'pre',
test: /\.tsx?$/,
loader: 'awesome-typescript-loader',
options: {
useBabel: true,
babelCore: '@babel/core',
babelOptions: helpers.getLoadersByName(config, 'babel-loader')[0].rule.options,
useCache: true,
cacheDirectory: "node_modules/.cache/awesome-typescript-loader",
}
});
config.output['globalObject'] = `(typeof self !== 'undefined' ? self : this)`;
// BABEL ---
//fastAsyncPlugin(config);
//flowPlugin(config);
// PLUGINS ---
//criticalCssPlugin(config, env);
/*const precacheConfig = {
navigateFallbackWhitelist: [/^(?!\/__)(?!\/popup).*!/]
};
swPrecachePlugin(config, precacheConfig);
config.plugins.push(
new HtmlWebpackPlugin({
filename: 'popup.html',
template: 'popup.ejs',
minify: {
minifyJS: true,
minifyCSS: true,
minifyURLs: true,
collapseWhitespace: true,
removeScriptTypeAttributes: true,
removeRedundantAttributes: true,
removeStyleLinkTypeAttributes: true,
removeComments: true
},
inject: false
}),
new webpack.DefinePlugin({
'process.env.FIREBASE_ENV': JSON.stringify(
process.env.FIREBASE_ENV === 'development'
? 'development'
: 'production'
)
})
);*/
/*if (!env.ssr && env.production) {
config.plugins.push(
new BundleAnalyzerPlugin({
analyzerMode: 'static'
})
);
}*/
}