Code Monkey home page Code Monkey logo

Comments (15)

RickWong avatar RickWong commented on May 21, 2024 1

It took a while but the server-side now uses Webpack too. That means many webpack loaders should work on the server as well including url-loader and css-loader. (Piping is also gone, the server gets instant code updates from Webpack HMR!)

So please try release ^5.0.0.

from react-isomorphic-starterkit.

RickWong avatar RickWong commented on May 21, 2024

Did you change that config in both webpack files?

from react-isomorphic-starterkit.

sslash avatar sslash commented on May 21, 2024

yes

from react-isomorphic-starterkit.

Semigradsky avatar Semigradsky commented on May 21, 2024

Looks like babel/register expects correct js file in require

from react-isomorphic-starterkit.

RickWong avatar RickWong commented on May 21, 2024

Ah... it makes sense. As it currently works, babel/register does not read from the config files. You'll need to configure it in babel.server.js, or use the require("url?...") syntax.

Right now I'm investigating the option to go back to webpack-built server builds with hot-reloading, instead of using babel/register. Should make this problem go away.

from react-isomorphic-starterkit.

sslash avatar sslash commented on May 21, 2024

I see. That was the reason I wanted to check out this repo in the first place though. So I could avoid building a huge React bundle and running that from Node (babel drops optimisation when files get too big, for instance)

from react-isomorphic-starterkit.

RickWong avatar RickWong commented on May 21, 2024

@sslash I'm using a technique by James Long @jlongster to exclude node_modules from the server build, and let node require them at runtime.

from react-isomorphic-starterkit.

sslash avatar sslash commented on May 21, 2024

Yes. Still these bundles tend to be quite large. However, using your current setup in this repo, I am still not able to require in png files. I am using require("url?./logo.png") as you propose, but it doesnt seem to locate the file. I am certain it is in the same directory and that I have included the url-loader properly. Are you able to make it work @RickWong?

from react-isomorphic-starterkit.

RickWong avatar RickWong commented on May 21, 2024

Haven't had a lot of time lately to release this. But the basic builds I've got aren't large at all. I'm talking about roughly 20 KB taking 1100 ms to build from a cold cache. Still having some issues with hot-reloading though...

from react-isomorphic-starterkit.

ericfong avatar ericfong commented on May 21, 2024

I try to remove babel/register in my project.
ES6 vs fast-reload
I go for fast-reload

from react-isomorphic-starterkit.

goldensunliu avatar goldensunliu commented on May 21, 2024

any update on this?

from react-isomorphic-starterkit.

Traviskn avatar Traviskn commented on May 21, 2024

the webpack isomorphic tools package may help with loading images, although it will require a bit of setup. It was made to solve the problem of require() 'ing images and css on the server: https://github.com/halt-hammerzeit/webpack-isomorphic-tools

from react-isomorphic-starterkit.

calvinl avatar calvinl commented on May 21, 2024

@sslash: I'm having the same issue with babel-core/register on the server side. Did you ever find a solution?

from react-isomorphic-starterkit.

sslash avatar sslash commented on May 21, 2024

nah haven't looked into this issue sry

from react-isomorphic-starterkit.

stkrzysiak avatar stkrzysiak commented on May 21, 2024

When I ran into this, I was running tests from the CLI. The solution that I found was to use require.extensions via a custom compiler. Not sure if this is of any help @calvinl or others, but I thought I would share. Here is an issue that outlines the fix in more detail: bruderstein/unexpected-react#1

from react-isomorphic-starterkit.

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.