xiongemi
xiongemi

Reputation: 209

How to use require in ionic 2

I want to use require.js in ionic 2. I uses something like

var createLogger = require('redux-logger');
var persistState = require('redux-localstorage');

However, the browser complaint about "Uncaught ReferenceError: require is not defined". I could not think of a way to include requirejs to my ionic 2 project. Please help.

Upvotes: 4

Views: 3335

Answers (1)

Sahil Daga
Sahil Daga

Reputation: 441

I am also trying to integrate RequireJs with Ionic 2. For your problem try this

declare var require: any;

use it after all your imports and before @Component or @Service

Upvotes: 8

Related Questions