You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Noticed that when bundling an SSR page that itself happened to contain template literal strings, Rollup was breaking.
For example
src/
pages/
posts.js
template/
app.html
And then app.html might look something like this
<!DOCTYPE html><htmllang="en" prefix="og:http://ogp.me/ns#"><head><title>Some Title</title><script>constmessage=`The current time is ${newDate().getTime()}`;alert(message);</script></head><body><page-outlet></page-outlet></body></html>
Will result in a parse error from Rollup
SyntaxError: Unexpected token (28:17) in /Users/owenbuckley/Workspace/project-evergreen/greenwood/packages/cli/test/cases/serve.default.ssr/.greenwood/_artists.js
at pp$4.raise (file:///Users/owenbuckley/Workspace/project-evergreen/greenwood/node_modules/rollup/dist/es/shared/rollup.js:19420:13)
at pp$9.unexpected (file:///Users/owenbuckley/Workspace/project-evergreen/greenwood/node_modules/rollup/dist/es/shared/rollup.js:16714:8)
at pp$9.semicolon (file:///Users/owenbuckley/Workspace/project-evergreen/greenwood/node_modules/rollup/dist/es/shared/rollup.js:16691:66)
at pp$8.parseVarStatement (file:///Users/owenbuckley/Workspace/project-evergreen/greenwood/node_modules/rollup/dist/es/shared/rollup.js:17122:8)
at pp$8.parseStatement (file:///Users/owenbuckley/Workspace/project-evergreen/greenwood/node_modules/rollup/dist/es/shared/rollup.js:16869:17)
at pp$8.parseBlock (file:///Users/owenbuckley/Workspace/project-evergreen/greenwood/node_modules/rollup/dist/es/shared/rollup.js:17190:21)
at pp$5.parseFunctionBody (file:///Users/owenbuckley/Workspace/project-evergreen/greenwood/node_modules/rollup/dist/es/shared/rollup.js:19246:22)
at pp$8.parseFunction (file:///Users/owenbuckley/Workspace/project-evergreen/greenwood/node_modules/rollup/dist/es/shared/rollup.js:17312:8)
at pp$8.parseFunctionStatement (file:///Users/owenbuckley/Workspace/project-evergreen/greenwood/node_modules/rollup/dist/es/shared/rollup.js:17012:15)
at pp$8.parseStatement (file:///Users/owenbuckley/Workspace/project-evergreen/greenwood/node_modules/rollup/dist/es/shared/rollup.js:16901:19) {
pos: 10688,
loc: {
column: 17,
file: '/Users/owenbuckley/Workspace/project-evergreen/greenwood/packages/cli/test/cases/serve.default.ssr/.greenwood/_artists.js',
line: 28
},
raisedAt: 10691,
frame: '26: <style>*{color:blue}h1{width:50%;margin:0 auto;text-align:center;color:red;}</style>\n' +
'27: <script type="module" src="/header.4557af3c.js"></script>\n' +
'28: <script>const e=`The current time is ${(new Date).getTime()}`;alert(e);\n' +
' ^\n' +
'29: //# sourceMappingURL=55016989.32ad046b.js.map\n' +
'30: </script>',
id: '/Users/owenbuckley/Workspace/project-evergreen/greenwood/packages/cli/test/cases/serve.default.ssr/.greenwood/_artists.js',
hook: 'transform',
code: 'PLUGIN_ERROR',
plugin: 'commonjs',
watchFiles: [
'/Users/owenbuckley/Workspace/project-evergreen/greenwood/packages/cli/test/cases/serve.default.ssr/.greenwood/_artists.js',
'/Users/owenbuckley/Workspace/project-evergreen/greenwood/packages/cli/test/cases/serve.default.ssr/.greenwood/_index.js',
'/Users/owenbuckley/Workspace/project-evergreen/greenwood/packages/cli/test/cases/serve.default.ssr/.greenwood/_users.js',
'/Users/owenbuckley/Workspace/project-evergreen/greenwood/packages/cli/test/cases/serve.default.ssr/src/pages/index.js',
'/Users/owenbuckley/Workspace/project-evergreen/greenwood/packages/cli/test/cases/serve.default.ssr/src/pages/artists.js',
'/Users/owenbuckley/Workspace/project-evergreen/greenwood/packages/cli/test/cases/serve.default.ssr/src/pages/users.js'
]
}
thescientist13
changed the title
template or page content with (inline) template strings breaks bundling of SSR pages
templates with (inline) template strings breaks bundling of SSR pages
Sep 25, 2023
Summary
Noticed that when bundling an SSR page that itself happened to contain template literal strings, Rollup was breaking.
For example
And then app.html might look something like this
Will result in a parse error from Rollup
Details
You'll notice that the parse error happens on a line where a the ` from app.html starts. This is likely an escaping issue with how we are "packing" static templates into SSR pages at build time.
The text was updated successfully, but these errors were encountered: