Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 374
xiongemi Avatar asked Feb 06 '23 19:02

xiongemi


1 Answers

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

like image 58
Sahil Daga Avatar answered Mar 04 '23 10:03

Sahil Daga