0

I have service and I am trying but I get error when I start page: enter image description here

compiled .js file has

reuired('@angular/core')

What can I check?

1 Answer 1

2

Just my experience with VS... regardless of the quick start tsconfig.json setting documented here

{
  "compilerOptions": {
    "target": "es5",
    "module": "commonjs",
    ...

in VS I had to use

{
  "compilerOptions": {
    "target": "es5",
    "module": "system",

module commonjs was generating modules with require not with System.register([ check the generated .js file...

Sign up to request clarification or add additional context in comments.

2 Comments

Well, in case there are other errors.. it seems that this issue is solved. At least in my case, that was the way how to fix "require" error, caused by different module system being generated by TS compiler...
When i have "system" in my tsconfig i have neew error: Uncaught TypeError: Invalid System.register call. Anonymous System.register calls can only be made by modules loaded by SystemJS.import and not via script tags.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.