Closed dalaoque closed 6 years ago
I got the same error, installing monaco-editor package helped in my case:
npm install vue-monaco-editor
same problem
I found the solutions in the document
By default, monaco-editor is loaded from a cdn asyncronously using require. To use a local copy of monaco-editor with webpack, we need to expose the dependency in our build directory:
npm install copy-webpack-plugin --save-dev
Add this to your webpack.config.js:
const CopyWebpackPlugin = require('copy-webpack-plugin');
module.exports = {
plugins: [
new CopyWebpackPlugin([
{
from: 'node_modules/monaco-editor/min/vs',
to: 'vs',
}
])
]
};
Then, specify the build directory path in the srcPath prop. See src/App.vue for an example.
i got it!
the reason is when compile code es2016 to es2015
The solution is add your webpack.config.js
loaders: [ { test: /\.js$/, loader: 'babel', include: [path.resolve(__dirname, '../src'), /vue-monaco-editor/] } ]
I try to build the app (with npm run build), the following error happens:
ERROR in static/js/vendor.11abc18390715624e180.js from UglifyJs SyntaxError: Unexpected token punc «(», expected punc «:» [./~/vue-monaco-editor /src/MonacoLoader.js:3,0]