Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closure compiler #7

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
180 changes: 164 additions & 16 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"rollup-plugin-auto-external": "2.0.0",
"rollup-plugin-css-only": "^2.1.0",
"rollup-plugin-execute": "^1.1.1",
"@ampproject/rollup-plugin-closure-compiler": "0.26.0",
"csso-cli": "^3.0.0",
"array-includes-any": "^2.7.3"
},
Expand Down
23 changes: 15 additions & 8 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import resolve from "@rollup/plugin-node-resolve"
import commonjs from "@rollup/plugin-commonjs"
import { terser } from "rollup-plugin-terser"
import closureCompiler from '@ampproject/rollup-plugin-closure-compiler';
// @ts-ignore
import autoExternal from "rollup-plugin-auto-external"

Expand Down Expand Up @@ -208,14 +209,20 @@ export function createPlugins(
// minify only in production mode
if (process.env.NODE_ENV === "production") {
plugins.push(
terser({
ecma: 2018,
warnings: true,
compress: {
drop_console: false,
},
})
)
closureCompiler({
compilation_level: "SIMPLE",
language_in: "ECMASCRIPT_2018",
language_out: "ECMASCRIPT_2018",
strict_mode_input: true,
use_types_for_optimization: true
}),
)
// terser({
// ecma: 2018,
// warnings: true,
// compress: {
// drop_console: false,
// }),
}

return plugins
Expand Down