question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Webpack 2 and Angular 2 compability?

See original GitHub issue

When using Unminified TinyMCE with webpack 2 and angular2, error is thrown and the app dies:

Error: Zone.js has detected that ZoneAwarePromise(window|global).Promisehas been overwritten

If I use minified version. that error is not thrown, however

Factory.ui is undefined

Feature request: Make TinyMCE compatible with module bundlers like webpack and work with angular2

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:24

github_iconTop GitHub Comments

2reactions
fyrkantcommented, Oct 17, 2016

Hi again @JT-Bruch, @thehashrocket and everyone!

Sorry for the mixup, apparently I was using the nightly build at work and that’s why it didn’t work like expected for you guys… But the good news is I found another way to get it working!

Instead of importing them in the component file, add the paths to the plugins to the scripts in your angular-cli.json just like you already did with tinymce, then it should be working!

See here for my working examples angular-cli.json file, and here for a deployed version.

So sorry for the mess, I will be updating the documentation today!

Edit: The documentation has now been updated!

2reactions
fyrkantcommented, Oct 6, 2016

Have you configured Webpack like it says in #2836 to use the imports-loader and exports-loader? Then you shouldn’t have to add it to the head tag.

If you are using angular-cli you can easily, without using any special loaders, use tinymce without having to add it to the head-tag by adding the path to TinyMCE to the angular-cli.json file, like it says in the documentation here.

So you would first install tinymce with npm install --save tinymce, then add "../node_modules/tinymce/tinymce.js" to your angular-cli.json and it should be available globally in your project.

Typescript will however complain that it “cannot fint name ‘tinymce’” so you would have to add something like, either directly in the file or to your typings.d.ts:

declare var tinymce: any;

To get the skins working you could then copy the skins folder from node_modules/tinymce/skins' tosrc/assets/skins` and configure TinyMCE when you initialize it with the url like this:

tinymce.init({
      selector: '#your-selector',
      skin_url: '/assets/skins/lightgray'
});

angular-cli will then be smart enough to copy along the assets both while developing with the dev server using ng serve, but also when you build your project with ng build.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Setting Up Angular 2 with Webpack - Semaphore Tutorial
In this tutorial we'll take a look at the steps needed to set up a test-driven Angular 2 project with Webpack and TypeScript....
Read more >
Angular without angular cli for Angular 12.x and webpack 5.x
Angular version was updated to the 5.1.2 and while I am testing the post code, I have got the npm debs exceptions. It...
Read more >
Would you use Webpack with Angular and Angular 2? - Quora
If your question is “If Webpack can be used with Angularjs?”, then yes it can and its a good idea to use it...
Read more >
webpack 2, angular 2 - using "require" with path built using ...
in the webpack.common.js file i've added new file to my entry object which i called : boot.js . so the structure is like...
Read more >
How To Use Custom webpack Configurations with Angular ...
How To Use Custom webpack Configurations with Angular CLI Builders · Step 1 — Setting Up the Project · Step 2 — Building...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found