mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 03:25:12 +01:00
remove comments in js bundles, saves ~100kb
This commit is contained in:
parent
c73d6bb3cb
commit
a094abf4da
@ -41,6 +41,7 @@
|
|||||||
"postcss-url": "^8.0.0",
|
"postcss-url": "^8.0.0",
|
||||||
"regenerator-runtime": "^0.13.7",
|
"regenerator-runtime": "^0.13.7",
|
||||||
"rollup": "^1.15.6",
|
"rollup": "^1.15.6",
|
||||||
|
"rollup-plugin-cleanup": "^3.1.1",
|
||||||
"serve-static": "^1.13.2",
|
"serve-static": "^1.13.2",
|
||||||
"xxhash": "^0.3.0"
|
"xxhash": "^0.3.0"
|
||||||
}
|
}
|
||||||
|
@ -34,6 +34,7 @@ import { nodeResolve } from '@rollup/plugin-node-resolve';
|
|||||||
import commonjs from '@rollup/plugin-commonjs';
|
import commonjs from '@rollup/plugin-commonjs';
|
||||||
// multi-entry plugin so we can add polyfill file to main
|
// multi-entry plugin so we can add polyfill file to main
|
||||||
import multi from '@rollup/plugin-multi-entry';
|
import multi from '@rollup/plugin-multi-entry';
|
||||||
|
import removeJsComments from 'rollup-plugin-cleanup';
|
||||||
// replace urls of asset names with content hashed version
|
// replace urls of asset names with content hashed version
|
||||||
import postcssUrl from "postcss-url";
|
import postcssUrl from "postcss-url";
|
||||||
|
|
||||||
@ -173,7 +174,10 @@ async function buildHtml(doc, version, assetPaths, manifestPath) {
|
|||||||
|
|
||||||
async function buildJs() {
|
async function buildJs() {
|
||||||
// create js bundle
|
// create js bundle
|
||||||
const bundle = await rollup.rollup({input: 'src/main.js'});
|
const bundle = await rollup.rollup({
|
||||||
|
input: 'src/main.js',
|
||||||
|
plugins: [removeJsComments({comments: "none"})]
|
||||||
|
});
|
||||||
const {output} = await bundle.generate({
|
const {output} = await bundle.generate({
|
||||||
format: 'es',
|
format: 'es',
|
||||||
name: `${PROJECT_ID}Bundle`
|
name: `${PROJECT_ID}Bundle`
|
||||||
@ -203,7 +207,7 @@ async function buildJsLegacy() {
|
|||||||
// create js bundle
|
// create js bundle
|
||||||
const rollupConfig = {
|
const rollupConfig = {
|
||||||
input: ['src/legacy-polyfill.js', 'src/main.js'],
|
input: ['src/legacy-polyfill.js', 'src/main.js'],
|
||||||
plugins: [multi(), commonjs(), nodeResolve(), babelPlugin]
|
plugins: [multi(), commonjs(), nodeResolve(), babelPlugin, removeJsComments({comments: "none"})]
|
||||||
};
|
};
|
||||||
const bundle = await rollup.rollup(rollupConfig);
|
const bundle = await rollup.rollup(rollupConfig);
|
||||||
const {output} = await bundle.generate({
|
const {output} = await bundle.generate({
|
||||||
|
Loading…
Reference in New Issue
Block a user