Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SyntaxError: Unexpected keyword 'default' #454

Open
hronro opened this issue Aug 23, 2021 · 0 comments · May be fixed by #471
Open

SyntaxError: Unexpected keyword 'default' #454

hronro opened this issue Aug 23, 2021 · 0 comments · May be fixed by #471

Comments

@hronro
Copy link

hronro commented Aug 23, 2021

What's the issue?

The build process crashed with a message:

node_modules/.pnpm/[email protected]/node_modules/acorn/dist/acorn.js:2927
    var err = new SyntaxError(message);
              ^
SyntaxError: Unexpected keyword 'default' (18:16)

How do we reproduce the issue?

// rollup.config.js
import rollupResolve from '@rollup/plugin-node-resolve';
import rollupCommonjs from '@rollup/plugin-commonjs';
import rollupReplace from '@rollup/plugin-replace';
import rollupPostcss from 'rollup-plugin-postcss';
import rollupJson from '@rollup/plugin-json';
import rollupClosureCompiler from '@ampproject/rollup-plugin-closure-compiler';

export default {
	input: 'src/index.js',
	external: Array.from(external),
	plugins: [
		rollupResolve({
			browser: true,
		}),
		rollupCommonjs(),
		rollupPostcss({
			extract: new URL(`./dist/${libName}.css`, import.meta.url).pathname,
			minimize: true,
		}),
		rollupReplace({
			values: {
				'process.env.NODE_ENV': JSON.stringify(
					isProduction ? 'production' : 'development'
				),
			},
			preventAssignment: true,
		}),
		rollupJson(),
		rollupClosureCompiler(),
	],
	output: {
		format: 'es',
		file: 'dist/lib.js',
	},
};

And in src/index.js, there is something like this: export default foobar;

If I remove the rollup-plugin-closure-compiler plugin, I could run rollup build successfully.

@HitkoDev HitkoDev linked a pull request Feb 17, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant