tui.image-editor: Can't resolve 'Fabric/fabric.require' in node_modules.

Module not found: Error: Can’t resolve ‘fabric/dist/fabric.require’ in ‘.\node_modules\tui-image-editor\dist’

I’ve already looked at former issues with fabric, these are not fixing the problem.

Version

“tui-image-editor”: “^3.2.2” Angular 6.1.0 Node 8.11 Tried with fabric 1.6.7 and 2.4.2

// Write example code
instance = new ImageEditor(document.querySelector('#tui-image-editor'),
        { cssMaxWidth: 700, cssMaxHeight: 500, selectionStyle: { cornerSize: 20, rotatingPointOffset: 70 }
        });

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 2
  • Comments: 15 (2 by maintainers)

Most upvoted comments

There is no fabric.require.js in fabric/dist/, there is only fabric.js but tui-image editor is still looking for fabric.require

Could somebody finally please fix this? The suggested workarounds did not help in my case.

“Fixed” the problem by replacing HTTP = require("http"), HTTPS = require("https") into HTTP = require("@angular/http"), HTTPS = require("@angular/http") in the fabric.require.js file.

Inside node modules, I don’t know If there are problems when deploying, but it let me work for the moment

“postinstall”: “npm install --no-save --no-optional fabric@~1.6.7”

this seems to be a work-around

“Fixed” the problem by replacing HTTP = require("http"), HTTPS = require("https") into HTTP = require("@angular/http"), HTTPS = require("@angular/http") in the fabric.require.js file.