Skip to content
This repository has been archived by the owner on Apr 18, 2018. It is now read-only.

Error: (SystemJS) require is not defined(…) #1

Open
Sicrum opened this issue Nov 7, 2016 · 8 comments
Open

Error: (SystemJS) require is not defined(…) #1

Sicrum opened this issue Nov 7, 2016 · 8 comments

Comments

@Sicrum
Copy link

Sicrum commented Nov 7, 2016

Hi there.

I am using VS2015 with Angular2.
Installed ng2-tab from npm and getting this:
"angular2-polyfills.js:349 Error: (SystemJS) require is not defined(…)"

Let me know if you need more details. Also, I can provide my PC via TeamViewer for debugging.

Thanks. Renat

P.S. stack:
angular2-polyfills.js:349 Error: (SystemJS) require is not defined
ReferenceError: require is not defined
at eval (http://localhost:50378/lib/npmlibs/ng2-tab/dist/index.js:11:14)
at eval (http://localhost:50378/lib/npmlibs/ng2-tab/dist/index.js:31:3)
at eval ()
Evaluating http://localhost:50378/lib/npmlibs/ng2-tab/dist/index.js
Error loading http://localhost:50378/lib/npmlibs/ng2-tab/dist/index.js as "ng2-tab" from http://localhost:50378/src/components/dashboard.component.js
at eval (http://localhost:50378/lib/npmlibs/ng2-tab/dist/index.js:11:14)
at eval (http://localhost:50378/lib/npmlibs/ng2-tab/dist/index.js:31:3)
at eval ()
Evaluating http://localhost:50378/lib/npmlibs/ng2-tab/dist/index.js
Error loading http://localhost:50378/lib/npmlibs/ng2-tab/dist/index.js as "ng2-tab" from http://localhost:50378/src/components/dashboard.component.js

@allenhwkim
Copy link
Contributor

allenhwkim commented Nov 7, 2016

Thanks for using this module, but this is out of scope question, I think.

A require statement is CommonJS module format, not SystemJS format

I also googled this,
http://stackoverflow.com/questions/34730010/angular2-5-minute-install-bug-require-is-not-defined

@Sicrum
Copy link
Author

Sicrum commented Nov 7, 2016

There is CommonJS speicified in my tsconfig. Do you think this is something related to Visual Studio?
{
"compilerOptions": {
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"module": "commonjs", << ====
"noEmitOnError": false,
"noImplicitAny": false,
"outDir": "../wwwroot/src/",
"removeComments": false,
"sourceMap": true,
"target": "es5"
},
"compileOnSave": true,
"exclude": [
"node_modules"
]
}

@allenhwkim
Copy link
Contributor

it must be systemjs to run your app on browser. http://stackoverflow.com/a/34954984/454252

@allenhwkim
Copy link
Contributor

allenhwkim commented Nov 7, 2016

Sorry, I found angular.io uses commonjs https://angular.io/docs/ts/latest/quickstart.html. I think I am missing something. Does your app run without ng2-tab?

If not, plz post this question to stackoverflow, so that you will get your answers a lot faster than here.

@Sicrum
Copy link
Author

Sicrum commented Nov 7, 2016

yeah, it was working ok before adding ng2-tab

@allenhwkim
Copy link
Contributor

Did you use ng2-tab.umd.js?

@allenhwkim
Copy link
Contributor

@Sicrum
Copy link
Author

Sicrum commented Nov 7, 2016

In System.config->Packages I have replaced index.js with ng2-tab.umd.js and got another issue: core_1.Input is not a function . There is something wrong with decorators referencing in TS file generated by webpack.
Generated TS file itself is ok. I copied it into my project and tabs component works ok

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants