Skip to content

Commit 82778c8

Browse files
committed
Reduce browser build size 1450kB -> 820kB
1 parent a7cc20b commit 82778c8

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
"test": "nyc --reporter=html --reporter=text mocha \"test/*/_index.js\"",
5353
"lint": "eslint .",
5454
"test-browser": "rollup -c && node ./test/browser.js",
55-
"prepublishOnly": "rollup -c"
55+
"prepublishOnly": "rm -rf dist && rollup -c"
5656
},
5757
"eslintConfig": {
5858
"ignorePatterns": [

rollup.config.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,14 @@ export default {
1313
},
1414
plugins: [
1515
{
16-
resolveId(importee) {
16+
resolveId(importee, importer) {
1717
if (['os', 'stream', 'string_decoder'].includes(importee)) {
1818
return importee;
1919
}
20+
// see https://github.com/csstree/csstree/pull/152
21+
if (importee === 'css-tree') {
22+
return this.resolve('css-tree/dist/csstree.min.js', importer);
23+
}
2024
},
2125
load(id) {
2226
if (id === 'os') {

test/browser.js

+1
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ const runTest = async () => {
5858
server.listen(5000, async () => {
5959
try {
6060
await runTest();
61+
console.info('Tested successfully');
6162
server.close()
6263
} catch (error) {
6364
server.close();

0 commit comments

Comments
 (0)