remove js comments in inline bundle #9395
-
how can i make parcel minify all inline content by removing unnecessary spaces in html and comments in js files? index.html <html>
<head>
</head>
<body>
<script type="module">
import "./index.js";
</script>
</body>
</html> index.js // index.js
/* index.js */ $ jq -r '.devDependencies.parcel' package.json
2.10.3
$ npx parcel build --public-url .
✨ Built in 98ms
dist/index.html 113 B 267ms
$ cat dist/index.html
<html><head><style></style></head><body> <script type="module">// index.js
/* index.js */</script> </body></html> |
Beta Was this translation helpful? Give feedback.
Answered by
electriquo
Nov 20, 2023
Replies: 1 comment 10 replies
-
found the solution: $ cat .htmlnanorc
{
"collapseWhitespace": "aggressive"
}
$ cat .terserrc
{
"format": {
"comments": false
}
} |
Beta Was this translation helpful? Give feedback.
10 replies
Answer selected by
electriquo
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
found the solution:
for removing comments in js files #7563 (comment)
for removing comments in html files https://htmlnano.netlify.app/modules#collapsewhitespace