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
I am having trouble building tooling/api on windows.
[!] Error: Unexpected token (Note that you need plugins to import files that are not JavaScript)
Full Error
PS C:\Users\ASUS\dev\tauri\tooling\api> yarn build
yarn run v1.22.10
$ rimraf ./dist && rollup -c --silent && node ./scripts/after-build.cjs
babelHelpers: 'bundled' option was used by default. It is recommended to configure this option explicitly, read more here: https://github.com/rollup/plugins/tree/master/packages/babel#babelhelpers
[!] Error: Unexpected token (Note that you need plugins to import files that are not JavaScript)
src\path.ts (13:23)
11: * @returns
12: */
13: async functionappDir(): Promise<string> {
^
14: return invokeTauriCommand<string>({15: __tauriModule: 'Fs',Error: Unexpected token (Note that you need plugins to import files that are not JavaScript) at error (C:\Users\ASUS\Dev\tauri\tooling\api\node_modules\rollup\dist\shared\rollup.js:5305:30) at Module.error (C:\Users\ASUS\Dev\tauri\tooling\api\node_modules\rollup\dist\shared\rollup.js:9750:16) at Module.tryParse (C:\Users\ASUS\Dev\tauri\tooling\api\node_modules\rollup\dist\shared\rollup.js:10156:25) at Module.setSource (C:\Users\ASUS\Dev\tauri\tooling\api\node_modules\rollup\dist\shared\rollup.js:10057:24) at ModuleLoader.addModuleSource (C:\Users\ASUS\Dev\tauri\tooling\api\node_modules\rollup\dist\shared\rollup.js:18403:20) at ModuleLoader.fetchModule (C:\Users\ASUS\Dev\tauri\tooling\api\node_modules\rollup\dist\shared\rollup.js:18459:9) at async Promise.all (index 2)error Command failed with exit code 1.info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
The steps I followed are such:
Clone the repo, dev branch
run ./scripts/setup.ps1
I've been able to narrow the issue down to the yarn build command that runs in tooling/api.
Interestingly, the specific file that produces the error varies each time, I have no idea why.
But each time the issue seems to be the same, namely for some reason rollup tries to interpret a TypeScript file as if it were JavaScript, and it predictably fails.
I have been able to "fix" this issue by removing the resolve plugin in rollup.config.js like so:
// code omited for brevityplugins: [commonjs({}),// remove the resolve plugin.// resolve({// // pass custom options to the resolve plugin// customResolveOptions: {// moduleDirectories: ['node_modules']// }// }),typescript({tsconfig: './tsconfig.json'}),babel({configFile: false,presets: [['@babel/preset-env'],['@babel/preset-typescript']]}),terser()],// code omited for brevity
I have no idea why this works, and I would suspect this could cause all kinds of issues so I'm not submitting a PR.
OS: Windows 10
Node: v14.16.1 (LTS)
Yarn: 1.22.10
The text was updated successfully, but these errors were encountered:
I just tried on the same OS, Node.js and Yarn versions and I couldn't reproduce it :( I'll have to close this, a lot of people successfully built the API package, I just think something weird happened on your install.
I am having trouble building
tooling/api
on windows.[!] Error: Unexpected token (Note that you need plugins to import files that are not JavaScript)
Full Error
The steps I followed are such:
./scripts/setup.ps1
I've been able to narrow the issue down to the
yarn build
command that runs intooling/api
.Interestingly, the specific file that produces the error varies each time, I have no idea why.
But each time the issue seems to be the same, namely for some reason rollup tries to interpret a TypeScript file as if it were JavaScript, and it predictably fails.
I have been able to "fix" this issue by removing the resolve plugin in
rollup.config.js
like so:I have no idea why this works, and I would suspect this could cause all kinds of issues so I'm not submitting a PR.
OS: Windows 10
Node: v14.16.1 (LTS)
Yarn: 1.22.10
The text was updated successfully, but these errors were encountered: