mirror of
https://github.com/chinchang/web-maker.git
synced 2025-06-21 15:04:01 +02:00
upgrade to preact-cli 4
This commit is contained in:
20939
package-lock.json
generated
20939
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -4,8 +4,8 @@
|
||||
"description": "A blazing fast & offline web playground",
|
||||
"scripts": {
|
||||
"start": "concurrently --kill-others \"gulp start-preview-server\" \"npm run -s dev\"",
|
||||
"build": "preact build --template src/index.html --prerender false --no-inline-css --sw false --esm false",
|
||||
"dev": "preact watch --template src/index.html",
|
||||
"build": "preact build --template src/index.ejs --prerender false --no-inline-css --sw false --esm false",
|
||||
"dev": "preact watch --template src/index.ejs",
|
||||
"serve-website": "cd packages/website; npm start",
|
||||
"build-website": "cd packages/website; npm run build",
|
||||
"lint": "eslint src",
|
||||
@ -65,7 +65,7 @@
|
||||
"markdown-it": "^8.4.2",
|
||||
"markdown-it-anchor": "^5.0.2",
|
||||
"merge-stream": "^1.0.1",
|
||||
"preact-cli": "^3.0.0",
|
||||
"preact-cli": "^4.0.0-next.6",
|
||||
"sw-precache": "^5.2.0"
|
||||
},
|
||||
"dependencies": {
|
||||
|
@ -1,5 +1,3 @@
|
||||
// var CommonsChunkPlugin = require('webpack/lib/optimize/CommonsChunkPlugin');
|
||||
|
||||
/**
|
||||
* Function that mutates original webpack config.
|
||||
* Supports asynchronous changes when promise is returned.
|
||||
@ -21,9 +19,9 @@ export default function (config, env, helpers) {
|
||||
htmlWebpackPlugin.plugin.options.favicon = false;
|
||||
|
||||
// Required for lingui-macros
|
||||
let { rule } = helpers.getLoadersByName(config, 'babel-loader')[0];
|
||||
let babelConfig = rule.options;
|
||||
babelConfig.plugins.push('macros');
|
||||
// let { rule } = helpers.getLoadersByName(config, 'babel-loader')[0];
|
||||
// let babelConfig = rule.options;
|
||||
// babelConfig.plugins.push('macros');
|
||||
|
||||
if (env.isProd) {
|
||||
config.devtool = false; // disable sourcemaps
|
||||
@ -33,25 +31,5 @@ export default function (config, env, helpers) {
|
||||
|
||||
// Remove the default hash append in chunk name
|
||||
config.output.chunkFilename = '[name].chunk.js';
|
||||
|
||||
// config.plugins.push(
|
||||
// new CommonsChunkPlugin({
|
||||
// name: 'vendor',
|
||||
// minChunks: ({ resource }) => /node_modules/.test(resource)
|
||||
// })
|
||||
// );
|
||||
|
||||
const swPlugin = helpers.getPluginsByName(
|
||||
config,
|
||||
'SWPrecacheWebpackPlugin'
|
||||
)[0];
|
||||
if (swPlugin) {
|
||||
// config.plugins.splice(swPlugin.index, 1);
|
||||
}
|
||||
|
||||
const uglifyPlugin = helpers.getPluginsByName(config, 'UglifyJsPlugin')[0];
|
||||
if (uglifyPlugin) {
|
||||
// config.plugins.splice(uglifyPlugin.index, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -11,11 +11,9 @@
|
||||
rel="manifest"
|
||||
href="<%= htmlWebpackPlugin.files.publicPath %>manifest.json"
|
||||
/>
|
||||
<% if (htmlWebpackPlugin.options.manifest.theme_color) { %>
|
||||
<meta
|
||||
name="theme-color"
|
||||
content="<%= htmlWebpackPlugin.options.manifest.theme_color %>"
|
||||
/>
|
||||
|
||||
<% if (cli.manifest.theme_color) { %>
|
||||
<meta name="theme-color" content="<%= cli.manifest.theme_color %>">
|
||||
<% } %>
|
||||
|
||||
<style>
|
||||
@ -73,13 +71,14 @@
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
<div id="portal"></div>
|
||||
<!-- SCRIPT-TAGS -->
|
||||
<%= htmlWebpackPlugin.options.ssr({ url: '/' }) %>
|
||||
<script
|
||||
defer
|
||||
src="<%= htmlWebpackPlugin.files.chunks['bundle'].entry %>"
|
||||
></script>
|
||||
|
||||
<!-- END-SCRIPT-TAGS -->
|
||||
<%= cli.ssr %>
|
||||
<% if (cli.config.prerender === true) { %>
|
||||
<script type="__PREACT_CLI_DATA__">
|
||||
<%= encodeURI(JSON.stringify(cli.CLI_DATA)) %>
|
||||
</script>
|
||||
<% } %>
|
||||
<script type="module" src="<%= cli.entrypoints['bundle'] %>"></script>
|
||||
<script nomodule src="<%= cli.entrypoints['dom-polyfills'] %>"></script>
|
||||
</body>
|
||||
</html>
|
Reference in New Issue
Block a user