Search code examples
angularjswebpacktextangular

Bundling textAngular and angular-sanitize with webpack


I'm currently in the process of migrating a project (ng 1.5.8) from gulp pipeline to webpack.
I'm facing an issue where textAngular gives me the following error message Module 'ngSanitize' is not available.
if I add a require('angular-sanitize') before the require('textangular') then I get the following error message The textAngular-sanitize provider has been replaced by another -- have you included angular-sanitize by mistake?
I've tried playing with the externals of my webpack config with no luck so far. I've also tried using angular-module-sanitize, didn't work either.
So here is my question: how can I configure properly webpack + my requires so textAngular has the proper dependencies provisionned? Thanks!


Solution

  • finnaly got it to work.
    The solution is to: - not require angular-sanitize
    - not do anything special to the webpack config
    - use these lines to require text angular instead (the generic one was including to much stuff)
    require('../../node_modules/textangular/dist/textAngular-sanitize.min'); require('../../node_modules/textangular/dist/textAngular.umd');