-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Closed
Labels
issue: bugDescribes why the code or behaviour is wrongDescribes why the code or behaviour is wrong
Description
Check for duplicates
- I have searched for similar issues before opening a new one.
Description
An error occurs when importing message files with filenames that contain hyphens (en-gb, zh-hant, etc).
In v11, a script for building message files was updated (#8091). The code below reveals that we directly use the filenames from msg/json/*.json to name the default export object.
https://github.com/google/blockly/blob/9519333c28662d20a4f4b73a68641a74965187b5/scripts/gulpfiles/build_tasks.js#L658-L688
However, hyphens are not legal in javascript names, which seems to be the root cause of the issue.
Reproduction steps
- Get Blockly through Create-package script.
- Import message files in index.js (ex: en-gb).
import * as enGb from 'blockly/msg/en-gb';
Stack trace
ERROR in ./node_modules/blockly/msg/en-gb.mjs 1:9
Module parse failed: Unexpected token (1:9)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
> import en-gb from './en-gb.js';
| export const {
| LOGIC_HUE,
@ ./src/index.js 8:0-42 16:18-22Screenshots
No response
Browsers
No response
Metadata
Metadata
Assignees
Labels
issue: bugDescribes why the code or behaviour is wrongDescribes why the code or behaviour is wrong