Syntax error . const function
-
Hi, sorry, I am not very experienced with nodejs.
I see the following error below.ERROR in ./src/ui/EditorToolbarConfig.js Module build failed (from ./node_modules/babel-loader/lib/index.js): SyntaxError: /Applications/MAMP/htdocs/prosemirror12/src/ui/EditorToolbarConfig.js: Unexpected token (166:13) 164 | '[image] Insert image': [ 165 | { > 166 | lang('Insert image by URL'): IMAGE_FROM_URL,
I have written a separate js file i18.js:
let lang_list = {} lang_list['en'] = {'Insert Table...': 'Insert Table...', 'Fill Color...': 'Fill Color...',} lang_list['zh'] = {'Insert Table...': 'Insert Table...', 'Fill Color...': 'Fill Color...', 'Border Color....': 'Border Color....'} export default function Lang(text) { if (text in lang_list['zh']) { return lang_list['zh'][text] } return text }
and I wish to load this file in here EditorToolbarConfig.js:
import Lang from './i18n'; export const COMMAND_GROUPS = [ { Lang( 'Insert image by URL'): FontTypeCommandMenuButton, }, { Lang( '[format_size] Text Size'): FontSizeCommandMenuButton, }]
For some reason, I see the error above.
Thanks!
-
This is not a forum for general Node.js assistance. This forum is the community forum for the Node-based forum software, NodeBB.
Copyright © 2024 NodeBB | Contributors