question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

System.import in isomorphic app

See original GitHub issue

Using webpack-2 and using the System.import feature. I cannot get it to work on an isomorphic app which errors with System.import is not a function, since System doesn’t exist on the server.

Any ideas for how to get it working on both?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
sokracommented, May 10, 2016

Three options:

polyfill

if(typeof System === "undefined") {
  var System = {
    import: function(path) {
      return Promise.resolve(require(path));
    }
  };
}

Transpile with babel

https://github.com/thgreasi/babel-plugin-system-import-transformer

Build with webpack

webpack --target node ...
0reactions
adriantoinecommented, Jun 9, 2016

@mmahalwy Hi! You can’t import a path without a prefix like that, see https://github.com/webpack/webpack/issues/2401

Read more comments on GitHub >

github_iconTop Results From Across the Web

javascript - Import in isomorphic app - Stack Overflow
omg... import looks like that: import {Dispatcher} from 'flux';. this file is located in folder "flux", i've created index.js file within this folder...
Read more >
Developing isomorphic applications using webpack - Medium
It uses react-dom to render ReactElement and append the resulting DOM to the #app element. /src/app/index.js import React from 'react'; import ReactDOM from...
Read more >
Chapter 11. Optimizing for production - Isomorphic Web ...
In an isomorphic app, your server's performance is just as important as the browser performance. When we first started working with React at...
Read more >
Tutorial - Setting Up a Simple Isomorphic React app - jmfurlott
Isomorphism · A user can visit your site without having Javascript enabled (and at least have a usable version) · There isn't an...
Read more >
The Pain and the Joy of creating isomorphic apps in ReactJS
Sometimes we make isomorphic apps too. The fundamental difference between regular SPA and isomorphic SPA is that in isomorphic SPA you will ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found