์ฌ๋ฌ ๋ชจ๋๋ฅผ ๊ฐ์ ธ์ฌ ๋ ์ค๋ฅ๊ฐ ๋ฐ์ํ์ต๋๋ค.
a8a2cc68-d2aa-4415-8e0e-e9de7978ead3:1 Refused to execute script from 'http://localhost:3000/worker-css.js' because its MIME type ('text/html') is not executable.
(anonymous) @ a8a2cc68-d2aa-4415-8e0e-e9de7978ead3:1
a8a2cc68-d2aa-4415-8e0e-e9de7978ead3:1 Uncaught DOMException: Failed to execute 'importScripts' on 'WorkerGlobalScope': The script at 'http://localhost:3000/worker-css.js' failed to load.
at blob:http://localhost:3000/a8a2cc68-d2aa-4415-8e0e-e9de7978ead3:1:1
์ด ์ค๋ฅ๋ ์๋ฌด ๊ฒ๋ ๋ง์น์ง ์์ผ๋ฉฐ ๋ชจ๋ ๊ฒ์ด ์๋ํ๋ฉฐ ๋ชจ๋๋ฅผ ์ฑ๊ณต์ ์ผ๋ก ๋ณ๊ฒฝํฉ๋๋ค.
์ฌ์ฉ์์๊ฒ ๋ค์ํ ๋ชจ๋(css, javascript, python ๋ฑ)๋ฅผ ์ ํํ ์ ์๋ ๊ธฐ๋ฅ์ ์ ๊ณตํ๊ณ ์์ต๋๋ค. ๋ฐ๋ผ์ ์ฌ์ฉ์๊ฐ ์ ํ๊ธฐ ๋ชฉ๋ก์์ ์์ฒญํ ๋ด์ฉ์ ๊ธฐ๋ฐ์ผ๋ก ํ๋ก๊ทธ๋๋ฐ ๋ฐฉ์์ผ๋ก ๋ชจ๋๋ฅผ ๊ฐ์ ธ์ค๊ณ ์์ต๋๋ค.
// This runs whenever a new mode is selected by the user
const handleModeChange = (event) => {
var currentMode = event.target.value;
require(`ace-builds/src-noconflict/mode-${currentMode}`)
setState({...state, currentMode})
}
<AceEditor
mode={state.currentMode}
width="100%"
theme="twilight"
value={state.code}
onChange={onChange}
name="code_editor"
editorProps={{ $blockScrolling: true }}
/>
๋์ผํ ์ค๋ฅ๊ฐ ๋ฐ์ํจ
import AceEditor from "react-ace"
import "ace-builds/src-noconflict/mode-javascript"
import "ace-builds/src-noconflict/theme-monokai"
//...
<AceEditor
name="Ace-editor"
mode="javascript"
fontSize={15}
wrapEnabled={true}
value={beautify(JSON.stringify(state.stepDetails))}
theme="monokai"
onChange={handleSchemaChange}
enableBasicAutocompletion={true}
enableLiveAutocompletion={true}
editorProps={{ $blockScrolling: true }}
/>
import "ace-builds/webpack-resolver"
์ถ๊ฐํ ํ ํด๊ฒฐ๋์์ต๋๋ค.
https://github.com/securingsincity/react-ace/issues/725#issuecomment -543109155 ์ฐธ์กฐ
@pi0neerpat ๊ฐ์ฌํฉ๋๋ค!
๊ฐ์ฅ ์ ์ฉํ ๋๊ธ
ํด๊ฒฐ์ฑ :
import "ace-builds/webpack-resolver"
์ถ๊ฐํ ํ ํด๊ฒฐ๋์์ต๋๋ค.https://github.com/securingsincity/react-ace/issues/725#issuecomment -543109155 ์ฐธ์กฐ