Closed
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.
blockly/scripts/gulpfiles/build_tasks.js
Lines 658 to 688 in 9519333
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-22
Screenshots
No response
Browsers
No response