sveltejs / sapper

The next small thing in web development, powered by Svelte
https://sapper.svelte.dev
MIT License
7.01k stars 435 forks source link

Regex in route breaks build in Sapper 0.29.0+ #1751

Closed xpuu closed 3 years ago

xpuu commented 3 years ago

Describe the bug & To Reproduce

  1. Create file [id([0-9]+)].svelte
  2. Put some HTML and corresponding CSS definition in it e.g. <div /><style> div { color: red; } </style>
  3. See error message in log

Logs

yarn run dev

✗ client
Invalid regular expression: /CSS_FILE_[id([0-9]+)].f26d79e2.js/: Unmatched ')'

yarn run build

> Building...

[!] (plugin css) SyntaxError: Invalid regular expression: /CSS_FILE_[id([0-9]+)].6926a295.js/: Unmatched ')'
SyntaxError: Invalid regular expression: /CSS_FILE_[id([0-9]+)].6926a295.js/: Unmatched ')'
    at new RegExp (<anonymous>)
    at Object.generateBundle (/home/xx/Personal/sappert/node_modules/sapper/dist/create_manifest_data.js:3844:49)
    at /home/xx/Personal/sappert/node_modules/rollup/dist/shared/rollup.js:18803:25
    at processTicksAndRejections (internal/process/task_queues.js:97:5)

error Command failed with exit code 1.

Expected behavior It should work :)

Severity Blocking

Additional context I found a reference to the same bug here https://github.com/domingues/rollup-plugin-css-chunks/issues/21. It seems that the problem was in this plugin. May be the solution is simple - upgrading dependency in Sapper.

PatrickG commented 3 years ago

Yea, this error will be fixed by bumping the rollup-plugin-css-chunks dependency in sapper. I forgot to make a pull request for sapper repo.

pesochek commented 3 years ago

@PatrickG @benmccann how to get this latest update via npm? It's 0.29.1 in the latest release both here and in npm, however here it was updated in March, while in npm it says "Published 5 months ago" and this dependency update is not applied. It's still ^2.0.2 there.

benmccann commented 3 years ago

I don't have permission to cut a new release on this project. It'd probably be faster to migrate to SvelteKit than wait for a release of this project

pesochek commented 3 years ago

Thanks. SvelteKit migration is in the plans, for now I'll just resort to the patch-package then.