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

Multi-line comments breaking chrome unpacked extension loading #455

Closed
melink14 opened this issue May 6, 2021 · 5 comments · Fixed by #456
Closed

Multi-line comments breaking chrome unpacked extension loading #455

melink14 opened this issue May 6, 2021 · 5 comments · Fixed by #456
Assignees
Labels
bug development Relating to developer flow and experience released

Comments

@melink14
Copy link
Owner

melink14 commented May 6, 2021

Reported here #363 (reply in thread) and confirmed by me recently.

Uncaught SyntaxError: Invalid or unexpected token

var __webpack_exports__ = {};
/*

data.js:2 (無名関数)

@melink14 melink14 added bug development Relating to developer flow and experience labels May 6, 2021
@melink14
Copy link
Owner Author

melink14 commented May 6, 2021

Probably caused by a BOM character being before the start of the file but after the webpack_exports.

But Sam said removing multiline comments fixed it for him...

@melink14 melink14 self-assigned this May 6, 2021
@melink14
Copy link
Owner Author

melink14 commented May 6, 2021

It looks like I can fix it by adding <meta charset="utf-8" /> to my background.html which I guess lets chrome know to expect those non breaking space characters.

@melink14
Copy link
Owner Author

melink14 commented May 6, 2021

It seems that it's also caused by the ts files being saved as UTF-8 with BOM in vscode which gets treated weirdly after compilation.

For some reason only data.ts and rikaichan.ts have this encoding so only they cause the problem.

Probably better to just resave the files without the encoding but I wonder if that will show up in version control

@melink14
Copy link
Owner Author

melink14 commented May 6, 2021

There's a eslint rule for encoding which I'll turn on to ensure no BOM problems.

Editor config has it but vscode doesn't support it yet.

If we wanted bom files then the html meta tag solution or a webpack plugin to add BOM would work.

melink14 added a commit that referenced this issue May 6, 2021
…ule to enforce it.

BOM markers were breaking chrome unpacked extension loading because webpack never adds BOM markers by default.

Fixes #455
TESTED=Built and packaged in chrome with no problems.
@mergify mergify bot closed this as completed in #456 May 6, 2021
mergify bot pushed a commit that referenced this issue May 6, 2021
…ule to enforce it. (#456)

BOM markers were breaking chrome unpacked extension loading because webpack never adds BOM markers by default.

Fixes #455
TESTED=Built and packaged in chrome with no problems.
melink14 added a commit that referenced this issue May 8, 2021
…ule to enforce it. (#456)

BOM markers were breaking chrome unpacked extension loading because webpack never adds BOM markers by default.

Fixes #455
TESTED=Built and packaged in chrome with no problems.
@melink14
Copy link
Owner Author

🎉 This issue has been resolved in version 1.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug development Relating to developer flow and experience released
Projects
None yet
1 participant