I'm trying to use rollup with the config below to bundle an expo react native app for npm publish, but at the moment I have the following error when I try to build with rollupJs:
$ rollup -csrc/index.ts → lib/index.js...[!] Error: Unexpected tokennode_modules/react-native/index.js (14:7)12: 13: // Components14: import typeof AccessibilityInfo from './Libraries/Components/AccessibilityInfo/AccessibilityInfo'; ^15: import typeof ActivityIndicator from './Libraries/Components/ActivityIndicator/ActivityIndicator';16: import typeof Button from './Libraries/Components/Button';Error: Unexpected token
my rollup.config.js that I mostly inherited, but I have checked online and most configs are like this:
import resolve from '@rollup/plugin-node-resolve';import commonjs from '@rollup/plugin-commonjs';import typescript from '@rollup/plugin-typescript';import dts from 'rollup-plugin-dts';import { terser } from 'rollup-plugin-terser';import peerDepsExternal from 'rollup-plugin-peer-deps-external';import image from '@rollup/plugin-image';import copy from 'rollup-plugin-copy';const packageJson = require('./package.json');export default [ { input: 'src/index.ts', output: [ { file: packageJson.module, format: 'esm', sourcemap: false, }, ], plugins: [ peerDepsExternal(), resolve(), commonjs(), typescript({ tsconfig: './tsconfig.json', exclude: ['./lib/**', './story/**', './App.tsx', '**/__tests__/**'], }), terser(), image(), copy({ targets: [{ src: 'assets/avatar_default.png', dest: 'lib/assets' }], }), ], external: [...Object.keys(packageJson.peerDependencies || {})], }, { input: 'lib/types/index.d.ts', output: [{ file: 'lib/index.d.ts', format: 'esm' }], plugins: [dts()], },];
not sure where I'm going wrong, it certainly has worked before