Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] Error on rocket build with a rollup plugin TypeError: Cannot read properties of undefined (reading 'startsWith') #430

Open
guillemcordoba opened this issue Sep 20, 2022 · 0 comments

Comments

@guillemcordoba
Copy link

Steps to reproduce:

  1. Run npx @rocket/create@latest, select the documentation theme.
  2. Cd into that folder and run npm install.
  3. Install @rollup/plugin-json with npm i -D @rollup/plugin-json.
  4. Change config/rocket.config.js, adding the rollup json plugin as stated in the documentation:
import json from '@rollup/plugin-json';
import { addPlugin } from 'plugins-manager';

/** @type {import('@rocket/cli').RocketCliOptions} */
export default {
  setupDevServerAndBuildPlugins: [addPlugin(json, { }, { location: 'top' })],
};
  1. Run npm run build.

This is the error that shows up:

guillem@guillem-thinkpad:~/projects/lab/rocket-commonjs-plugin-repro$ npm run build

> [email protected] build
> rocket build

Engine building...
Generating Open Graph Images...
Optimize Production Build...
TypeError: Cannot read properties of undefined (reading 'startsWith')
    at Object.transform (/home/guillem/projects/lab/rocket-commonjs-plugin-repro/node_modules/@web/dev-server-rollup/dist/rollupAdapter.js:228:30)
    at file:///home/guillem/projects/lab/rocket-commonjs-plugin-repro/node_modules/rollup/dist/es/shared/rollup.js:22717:40 {
  code: 'PLUGIN_ERROR',
  plugin: 'json',
  hook: 'transform',
  id: '/home/guillem/projects/lab/rocket-commonjs-plugin-repro/_site-dev/inline-module-ad21fcfbb3d325880e51446273377108.js',
  watchFiles: [
    '/home/guillem/projects/lab/rocket-commonjs-plugin-repro/_site-dev/404.html',

Here is a reproduction repository: https://github.com/guillemcordoba/rocket-commonjs-plugin-repro

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant