Skip to content

Cannot split a chunk that has already been edited #208

Description

@danielroe

calling s.replace() after previously replacing a section in a magic string throws the following error:

 ERROR  Cannot split a chunk that has already been edited (0:63 – "const base = '/__NUXT_BASE__/'")    09:37:01

  at MagicString._splitChunk (node_modules/magic-string/dist/magic-string.cjs.js:893:10)
  at MagicString._split (node_modules/magic-string/dist/magic-string.cjs.js:883:43)
  at MagicString.overwrite (node_modules/magic-string/dist/magic-string.cjs.js:670:8)
  at node_modules/magic-string/dist/magic-string.cjs.js:1054:11
  at Array.forEach (<anonymous>)
  at MagicString.replace (node_modules/magic-string/dist/magic-string.cjs.js:1052:12)
  at Object.transform (src/plugins/dynamic-base.ts:89:11)
  at node_modules/rollup/dist/shared/rollup.js:22795:37
  at processTicksAndRejections (internal/process/task_queues.js:95:5)

cc: @antfu
related: nuxt/nuxt#13439

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions