imzbf / md-editor-v3

Markdown editor for vue3, developed in jsx and typescript, dark theme、beautify content by prettier、render articles directly、paste or clip the picture and upload it...
https://imzbf.github.io/md-editor-v3
MIT License
1.65k stars 157 forks source link

what loader the module should use? #456

Closed cageq closed 8 months ago

cageq commented 8 months ago

描述这个Bug

ERROR Failed to compile with 3 errors 10:06:32 AM

error in ./node_modules/md-editor-v3/lib/es/MdEditor.mjs

Module parse failed: Unexpected token (1082:30) 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 | s = s.concat(u); | const { lines: b } = n.state.doc;

let p = 1, y = u.shift() ?? b;

| for (let C = 1; C <= b; C++) | C === y && (p = C, y = u.shift() || b + 1), f.push({

@ ./node_modules/md-editor-v3/lib/es/index.mjs 1:0-46 30:0-45:2 @ ./node_modules/cache-loader/dist/cjs.js??ref--13-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader-v16/dist??ref--1-1!./src/Chat.vue?vue&type=script&lang=js @ ./src/Chat.vue?vue&type=script&lang=js @ ./src/Chat.vue @ ./node_modules/cache-loader/dist/cjs.js??ref--13-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader-v16/dist??ref--1-1!./src/App.vue?vue&type=script&lang=js @ ./src/App.vue?vue&type=script&lang=js @ ./src/App.vue @ ./src/main.js @ multi (webpack)-dev-server/client?http://172.24.167.254:8080&sockPath=/sockjs-node (webpack)/hot/dev-server.js ./src/main.js

error in ./node_modules/@lezer/yaml/dist/index.js

Module parse failed: Unexpected token (44:13) 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 }
static top = new Context(null, -1, type_Top) }

@ ./node_modules/@codemirror/lang-yaml/dist/index.js 1:0-37 11:25-31 @ ./node_modules/@codemirror/language-data/dist/index.cjs @ ./node_modules/md-editor-v3/lib/es/index.mjs @ ./node_modules/cache-loader/dist/cjs.js??ref--13-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader-v16/dist??ref--1-1!./src/Chat.vue?vue&type=script&lang=js @ ./src/Chat.vue?vue&type=script&lang=js @ ./src/Chat.vue @ ./node_modules/cache-loader/dist/cjs.js??ref--13-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader-v16/dist??ref--1-1!./src/App.vue?vue&type=script&lang=js @ ./src/App.vue?vue&type=script&lang=js @ ./src/App.vue @ ./src/main.js @ multi (webpack)-dev-server/client?http://172.24.167.254:8080&sockPath=/sockjs-node (webpack)/hot/dev-server.js ./src/main.js

版本号

v20.11.0

问题重现链接

No response

cageq commented 8 months ago

could add this to vue.config.js to fix the error, is it correct?

module.exports = { chainWebpack: config => { config.module .rule('mjs') .test(/.(m?js|ts)$/) .include.add(/node_modules\/md-editor-v3/) // specify the package path .end()

    .use('babel-loader')
    .loader('babel-loader')
    .end();
}

};

imzbf commented 8 months ago

Maybe we need to upgrade the development environment