-
Notifications
You must be signed in to change notification settings - Fork 107
Closed
Labels
Description
Using import type { WithRequired } from '@apollo/utils.withrequired' in a file that is processed with unbuild yields the following error:
Error building /workspaces/apollo-server-integration-h3: SyntaxError: Unexpected token (1:8) in /workspaces/apollo-server-integration-h3/node_modules/.pnpm/@[email protected]/node_modules/@apollo/utils.withrequired/dist/index.d.ts
SyntaxError: Unexpected token (1:8) in /workspaces/apollo-server-integration-h3/node_modules/.pnpm/@[email protected]/node_modules/@apollo/utils.withrequired/dist/index.d.ts
at pp$4.raise (file:///workspaces/apollo-server-integration-h3/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/rollup.js:19861:13)
at pp$9.unexpected (file:///workspaces/apollo-server-integration-h3/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/rollup.js:17162:8)
at pp$9.semicolon (file:///workspaces/apollo-server-integration-h3/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/rollup.js:17139:66)
at pp$8.parseExpressionStatement (file:///workspaces/apollo-server-integration-h3/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/rollup.js:17622:8)
at pp$8.parseStatement (file:///workspaces/apollo-server-integration-h3/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/rollup.js:17355:24)
at pp$8.parseTopLevel (file:///workspaces/apollo-server-integration-h3/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/rollup.js:17219:21)
at Parser.parse (file:///workspaces/apollo-server-integration-h3/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/rollup.js:16991:15)
at Function.parse (file:///workspaces/apollo-server-integration-h3/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/rollup.js:17041:35)
at Graph.contextParse (file:///workspaces/apollo-server-integration-h3/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/rollup.js:23356:38)
at tryParse (file:///workspaces/apollo-server-integration-h3/node_modules/.pnpm/@[email protected][email protected]/node_modules/@rollup/plugin-commonjs/dist/es/index.js:17:12) {
pos: 8,
loc: {
column: 8,
file: '/workspaces/apollo-server-integration-h3/node_modules/.pnpm/@[email protected]/node_modules/@apollo/utils.withrequired/dist/index.d.ts',
line: 1
},
raisedAt: 12,
frame: '1: declare type WithRequired<T, K extends keyof T> = T & Required<Pick<T, K>>;\n' +
' ^\n' +
'2: export = WithRequired;\n' +
'3: //# sourceMappingURL=index.d.ts.map',
id: '/workspaces/apollo-server-integration-h3/node_modules/.pnpm/@[email protected]/node_modules/@apollo/utils.withrequired/dist/index.d.ts',
hook: 'resolveId',
code: 'PLUGIN_ERROR',
plugin: 'commonjs--resolver',
watchFiles: [
'/workspaces/apollo-server-integration-h3/src/index.ts',
'/workspaces/apollo-server-integration-h3/node_modules/.pnpm/@[email protected]/node_modules/@apollo/utils.withrequired/dist/index.d.ts'
]
}
I think the issue lies in
Lines 237 to 240 in da197ec
| ctx.options.rollup.commonjs && commonjs({ | |
| extensions: DEFAULT_EXTENSIONS, | |
| ...ctx.options.rollup.commonjs | |
| }), |
Reproduction: apollo-server-integrations/apollo-server-integration-h3#12
leo91000, tuarrep, huang-julien, deleonio, trevor-scheer and 12 more