vendredi 7 février 2020

Integrate monaco editor into ember octane

I try to integrate the monaco code editor into my ember octane application. Currently I'm using the ESM import style and confirming to the manual, I installed the webpack loader plugin and integrated it into my ember-cli-build.js

const EmberApp = require('ember-cli/lib/broccoli/ember-app');
const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin');

module.exports = function(defaults) {
  let app = new EmberApp(defaults, {
    autoImport: {
      webpack: {
        plugins: [
          new MonacoWebpackPlugin()
        ]
      }
    }
  });

  // Use `app.import` to add additional libraries to the generated
  // output files.
  //
  // If you need to use different assets in different
  // environments, specify an object as the first parameter. That
  // object's keys should be the environment name and the values
  // should be the asset to use in that environment.
  //
  // If the library that you are including contains AMD or ES6
  // modules that you would like to import into your application
  // please specify an object with the list of modules as keys
  // along with the exports of each module as its value.

  return app.toTree();
};

But when building my application, I always get the error messages:

Module parse failed: Unexpected token (8:0) You may need an appropriate loader to handle this file type.

And

(node:7993) UnhandledPromiseRejectionWarning: Error: webpack returned errors to ember-auto-import

Can anyone help me and tell me how to integrate monaco correctly into my ember application? Thank you very much!




Aucun commentaire:

Enregistrer un commentaire