Git Product home page Git Product logo

Comments (12)

barbatus avatar barbatus commented on May 20, 2024

Yes, I'll add it for sure. Though, presence of main.ts is not required like you said; if it's there it'll be imported if it's not you'll need to import another module manually.

from angular2-meteor.

sclausen avatar sclausen commented on May 20, 2024

How do you import another module on the server to be executed at startup?

from angular2-meteor.

barbatus avatar barbatus commented on May 20, 2024

Same way you'd do it for client side:
add main.js with

Meteor.startup(function(){
 System.import('server/foo').await();
})

from angular2-meteor.

sclausen avatar sclausen commented on May 20, 2024

Hmm, maybe I got the wrong idea how stuff works, bu if you don't create a main.ts on the server, no code will be executed there, so where would you define this import?

from angular2-meteor.

sclausen avatar sclausen commented on May 20, 2024

Maybe I slowly got it. js files are executed normally without being registered as system.js modules, so
I could create a foo.js on the server with

Meteor.startup(function(){
 System.import('server/foo').await();
})

right!?

from angular2-meteor.

barbatus avatar barbatus commented on May 20, 2024

@sclausen yes, exactly. foo.ts

from angular2-meteor.

sclausen avatar sclausen commented on May 20, 2024

Hmm, but the server doesn't know about system.js…

While processing files with barbatus:angular2 (for target
   os.linux.x86_64):
   /server/notmain.ts:16:2: Cannot find name 'System'.

Do I have to manually add systemjs:systemjs to my project, or am I doing something still wrong?
I think this would be an inconvenient workaround to use something different than the automatically loaded main.ts.

from angular2-meteor.

barbatus avatar barbatus commented on May 20, 2024

You seem to be missing something. If there wasn't System defined on the server, it wouldn't work even with main.ts.

from angular2-meteor.

barbatus avatar barbatus commented on May 20, 2024

systemjs:systemjs should be added to your app by the package.

from angular2-meteor.

sclausen avatar sclausen commented on May 20, 2024

Okay, I don't know, what I did wrong before. Everything now works as expected. The custom import in a server-side js-file works like a charm.

from angular2-meteor.

barbatus avatar barbatus commented on May 20, 2024

Use System in pure .js-files, in .ts ones you don't need it

from angular2-meteor.

sclausen avatar sclausen commented on May 20, 2024

Yeah I know, I got that after writing my third comment in this issue, but I did something wrong and was confused about the server not knowing anything about the systemjs:systemjs in my js-file although added it in barbatus:angular2… Thanks for clarification! ☺️

from angular2-meteor.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.