Skip to content

Commit 53e9621

Browse files
author
Loïc Mangeonjean
committed
fix: fix build after lib update
1 parent c967fb2 commit 53e9621

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
"test": "npx jest",
88
"test:watch": "jest --watch",
99
"build": "npm run test && npm run compile && npm run generate-types",
10-
"compile": "rollup --config rollup.config.ts --configPlugin typescript",
11-
"generate-types": "tsc --project tsconfig.types.json && rollup --config rollup.types.config.ts --configPlugin typescript && rm -rf ./dist/types",
10+
"compile": "node --experimental-json-modules ./node_modules/.bin/rollup --config rollup.config.ts --configPlugin typescript",
11+
"generate-types": "tsc --project tsconfig.types.json && node --experimental-json-modules ./node_modules/.bin/rollup --config rollup.types.config.ts --configPlugin typescript && rm -rf ./dist/types",
1212
"preprepare": "./scripts/install-extensions"
1313
},
1414
"repository": {

rollup.config.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import visualizer from 'rollup-plugin-visualizer'
1+
import { visualizer } from 'rollup-plugin-visualizer'
22
import commonjs from '@rollup/plugin-commonjs'
33
import alias from '@rollup/plugin-alias'
44
import { nodeResolve } from '@rollup/plugin-node-resolve'
@@ -7,9 +7,14 @@ import { babel } from '@rollup/plugin-babel'
77
import cleanup from 'js-cleanup'
88
import * as rollup from 'rollup'
99
import * as recast from 'recast'
10+
import recastBabylonParser from 'recast/parsers/babylon.js'
1011
import nodePolyfills from 'rollup-plugin-polyfill-node'
11-
import path from 'path'
12-
import pkg from './package.json'
12+
import path, { dirname } from 'path'
13+
import { fileURLToPath } from 'url'
14+
import pkg from './package.json' assert { type: 'json' }
15+
16+
const __filename = fileURLToPath(import.meta.url)
17+
const __dirname = dirname(__filename)
1318

1419
const PURE_ANNO = '#__PURE__'
1520
const EXTENSION_DIR = path.resolve(__dirname, 'extensions')
@@ -130,7 +135,7 @@ export default rollup.defineConfig({
130135
transform (code, id) {
131136
if (id.startsWith(EXTENSION_DIR)) {
132137
const ast = recast.parse(code, {
133-
parser: require('recast/parsers/babylon')
138+
parser: recastBabylonParser
134139
})
135140
let transformed: boolean = false
136141
function addComment (node: recast.types.namedTypes.Expression) {

rollup.types.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as rollup from 'rollup'
22
import dts from 'rollup-plugin-dts'
3-
import pkg from './package.json'
3+
import pkg from './package.json' assert { type: 'json' }
44
import removeVscodeDeclareModule from './rollup/rollup-plugin-remove-vscode-declare-module'
55

66
const externals = [

0 commit comments

Comments
 (0)