angular2-websocket icon indicating copy to clipboard operation
angular2-websocket copied to clipboard

require is not defined using rc.3

Open moscoquera opened this issue 9 years ago • 1 comments

Hi guys, im not a fluent js developer, so this is new for me. im trying to add your library in to a little project, but im getting this error in the browers console:

angular2-websocket.js:11Uncaught ReferenceError: require is not defined

im loading this libraries for angular2:

`

<script type="text/javascript" src="node_modules/zone.js/dist/zone.js"></script>
<script type="text/javascript" src="node_modules/reflect-metadata/Reflect.js"></script>
<script type="text/javascript" src="node_modules/rxjs/bundles/Rx.umd.js"></script>
<script type="text/javascript" src="node_modules/@angular/core/bundles/core.umd.js"></script>
<script type="text/javascript" src="node_modules/@angular/common/bundles/common.umd.js"></script>
<script type="text/javascript" src="node_modules/@angular/compiler/bundles/compiler.umd.js"></script>
<script type="text/javascript" src="node_modules/@angular/platform-browser/bundles/platform-browser.umd.js"></script>
<script type="text/javascript" src="node_modules/@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js"></script>

<!-- librerias usadas -->
<script type="text/javascript" src="media/js/angular2-websocket.js"></script>`

moscoquera avatar Jul 01 '16 03:07 moscoquera

@moscoquera, I'm pretty sure you can't do it this way. Angular 2 switched to UMD modules since RC. Before, all the bundles were wrapped in System.register calls so you can just include them into your HTML.

No more. With the final release, you'll have to use a bundler (like WebPack or System.js build) to make a build. A huge hassle if you ask me.

I've hand-made a bundle with everything that'll work as you had. Let me know if you still want it.

schungx avatar Sep 27 '16 07:09 schungx