rollup-plugin-swc icon indicating copy to clipboard operation
rollup-plugin-swc copied to clipboard

fallbackBindings.transform is not a function

Open leap0x7b opened this issue 2 years ago • 2 comments

(node:16032) ExperimentalWarning: Importing JSON modules is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)

src/index.ts → dist/index.js...
[!] (plugin swc) TypeError: fallbackBindings.transform is not a function
src/index.ts
    at Compiler.<anonymous> (/data/data/com.termux/files/home/ffmpeg-discord/node_modules/.pnpm/@[email protected]/node_modules/@swc/core/index.js:223:41)
    at Generator.next (<anonymous>)
    at /data/data/com.termux/files/home/ffmpeg-discord/node_modules/.pnpm/@[email protected]/node_modules/@swc/core/index.js:34:71
    at new Promise (<anonymous>)
    at __awaiter (/data/data/com.termux/files/home/ffmpeg-discord/node_modules/.pnpm/@[email protected]/node_modules/@swc/core/index.js:30:12)
    at Compiler.transform (/data/data/com.termux/files/home/ffmpeg-discord/node_modules/.pnpm/@[email protected]/node_modules/@swc/core/index.js:202:16)
    at transform (/data/data/com.termux/files/home/ffmpeg-discord/node_modules/.pnpm/@[email protected]/node_modules/@swc/core/index.js:344:21)
    at Object.transform (file:///data/data/com.termux/files/home/ffmpeg-discord/node_modules/.pnpm/[email protected]_zz5argbrqg64xved5wkdukot6e/node_modules/rollup-plugin-swc3/dist/index.mjs:129:20)
    at /data/data/com.termux/files/home/ffmpeg-discord/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/shared/rollup.js:24076:40

My rollup.config.js

import alias from '@rollup/plugin-alias';
import commonjs from '@rollup/plugin-commonjs';
import { nodeResolve } from '@rollup/plugin-node-resolve';
// import exportDirectoryRollup from 'export-directory/dist/rollup';
import { resolve } from 'path';
import { swc, defineRollupSwcOption } from 'rollup-plugin-swc3';
import swcConfig from './.swcrc.json' assert { type: "json" };

export default {
  input: 'src/index.ts',
  output: {
    file: 'dist/index.js',
    format: 'esm',
  },
  plugins: [
    swc(defineRollupSwcOption(swcConfig)),
    alias({
      entries: {
        $lib: resolve('./src/lib'),
        $core: resolve('./src/core'),
      },
    }),
    // exportDirectoryRollup({}),
    commonjs(),
    nodeResolve({
      browser: true,
      extensions: ['.mjs', '.js', '.ts', '.json'],
    }),
  ],
};

leap0x7b avatar Dec 28 '22 03:12 leap0x7b

Do you have @swc/core installed?

SukkaW avatar Dec 28 '22 10:12 SukkaW

Yes

leap0x7b avatar Dec 29 '22 01:12 leap0x7b