Skip to content

Commit

Permalink
fix(node-bench): apply @rollup/plugin-commonjs on rollup (#523)
Browse files Browse the repository at this point in the history
<!-- Thank you for contributing! -->

### Description

<!-- Please insert your description here and provide especially info about the "what" this PR is solving -->

### Test Plan

<!-- e.g. is there anything you'd like reviewers to focus on? -->

---
  • Loading branch information
hyf0 committed Mar 10, 2024
1 parent 71da395 commit 181422a
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 10 deletions.
14 changes: 9 additions & 5 deletions packages/bench/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import * as rolldown from '@rolldown/node'
import * as esbuild from 'esbuild'
import * as rollup from 'rollup'
import { nodeResolve } from '@rollup/plugin-node-resolve';

import commonjs from '@rollup/plugin-commonjs';

const dirname = path.dirname(url.fileURLToPath(import.meta.url))
const repoRoot = path.join(dirname, '../../')
Expand Down Expand Up @@ -88,10 +88,14 @@ async function runRollup(item) {
onwarn: (_warning, _defaultHandler) => {
// ignore warnings
},
plugins: [nodeResolve({
exportConditions: ['import'],
mainFields: ['module', 'browser', 'main'],
})]
plugins: [
nodeResolve({
exportConditions: ['import'],
mainFields: ['module', 'browser', 'main'],
}),
// @ts-expect-error Something is wrong with the types
commonjs(),
]
})
await build.write({
dir: path.join(dirname, `./dist/rollup/${item.title}`),
Expand Down
10 changes: 5 additions & 5 deletions packages/bench/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@
"scripts": {
"bench": "node ./index.js"
},
"devDependencies": {
"@rolldown/node": "workspace:*",
"esbuild": "^0.20.1"
},
"dependencies": {
"@rolldown/node": "workspace:*",
"esbuild": "^0.20.1",
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-node-resolve": "^15.2.3",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"rollup": "^4.12.1",
"tinybench": "^2.6.0",
"typescript": "^5.4.2",
"vue": "^3.4.21",
"vue-router": "^4.3.0"
}
}
}
1 change: 1 addition & 0 deletions packages/bench/vue-entry.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { createApp } from 'vue'
import { createRouter, createWebHistory } from 'vue-router'

// @ts-ignore
const router = createRouter({
history: createWebHistory(),
})
Expand Down
2 changes: 2 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3328,12 +3328,14 @@ __metadata:
resolution: "bench@workspace:packages/bench"
dependencies:
"@rolldown/node": "workspace:*"
"@rollup/plugin-commonjs": "npm:^25.0.7"
"@rollup/plugin-node-resolve": "npm:^15.2.3"
esbuild: "npm:^0.20.1"
react: "npm:^18.2.0"
react-dom: "npm:^18.2.0"
rollup: "npm:^4.12.1"
tinybench: "npm:^2.6.0"
typescript: "npm:^5.4.2"
vue: "npm:^3.4.21"
vue-router: "npm:^4.3.0"
languageName: unknown
Expand Down

0 comments on commit 181422a

Please sign in to comment.