Giter Club home page Giter Club logo

Comments (24)

kof avatar kof commented on September 18, 2024

why do you try to use css-vendor on the server?

from css-vendor.

kof avatar kof commented on September 18, 2024

you do realize that this package only makes sense in the browser?

from css-vendor.

jasonkuhrt avatar jasonkuhrt commented on September 18, 2024

@kof I believe if you review the linked use-cases it should be clear. Writing Isomorphic JavaScript requires that the code adapts at runtime. Perhaps a future approach could see Isomorphic JavaScript resolved statically but that is way out of scope whereas this requested feature trivial: Give the user a function instead of executing code on their behalf.

from css-vendor.

jasonkuhrt avatar jasonkuhrt commented on September 18, 2024

The use-case is Server Side Rendering. In this case the API I'm working with is React.renderToString but there is simply nothing here particular to React. The principal of Server Side Rendering and Isomorphic JavaScript is generic.

from css-vendor.

kof avatar kof commented on September 18, 2024

So you never have if (weAreOnServer) do this ... you expect EVERY single module to adapt if we are on server even if a module was designed to run in browser???

from css-vendor.

kof avatar kof commented on September 18, 2024

Does it works for things like localStorage etc?

from css-vendor.

kof avatar kof commented on September 18, 2024

ohhhhhh I get now the prob .... its because require is called before you can actually decide whether you need some module or not in a particular env, got it.

from css-vendor.

kof avatar kof commented on September 18, 2024

give me a sec

from css-vendor.

jasonkuhrt avatar jasonkuhrt commented on September 18, 2024

: D

from css-vendor.

kof avatar kof commented on September 18, 2024

fixed and published, thanks

from css-vendor.

jasonkuhrt avatar jasonkuhrt commented on September 18, 2024

Are you sure you published?

npm ERR! notarget No compatible version found: css-vendor@'>=0.2.4 <0.3.0'
npm ERR! notarget Valid install targets:
npm ERR! notarget ["0.1.0","0.2.0","0.2.1","0.2.2","0.2.3"]

Note missing 0.2.4 that you said you published.

from css-vendor.

kof avatar kof commented on September 18, 2024

apparantly not ... sorry ... but now

from css-vendor.

jasonkuhrt avatar jasonkuhrt commented on September 18, 2024

Also some gaps in your initial patch (sorry to be the bearer of lame news):

from css-vendor.

jasonkuhrt avatar jasonkuhrt commented on September 18, 2024

apparantly not ... sorry ... but now

Yep works now thanks! Just a few parts of the codebase that need to be updated now. Want me to get a PR going for this to help or not?

from css-vendor.

kof avatar kof commented on September 18, 2024

sure, prs are always welcome ...

from css-vendor.

jasonkuhrt avatar jasonkuhrt commented on September 18, 2024

Ok great. I'll try to put something together in the near future. Also I suggest we re-open this issue until said PR is merged etc.

from css-vendor.

kof avatar kof commented on September 18, 2024

oh so its still the same issue with dom?

from css-vendor.

jasonkuhrt avatar jasonkuhrt commented on September 18, 2024

For this issue to be resolved all dependencies on the Browser need to be guarded by environment checks which is what you have started to do. The alternative solution I suggested was to store these dependencies inside functions. The links above show where this library still makes unqualified use of the browser environment.

from css-vendor.

kof avatar kof commented on September 18, 2024

oh right, I checked only the one use pointed to first.

from css-vendor.

kof avatar kof commented on September 18, 2024

ok fixed and published again.

from css-vendor.

jasonkuhrt avatar jasonkuhrt commented on September 18, 2024

Still not working:

/Users/jasonkuhrt/projects/react-popover/node_modules/css-vendor/lib/supported-value.js:27
    el.style[property] = value
      ^
TypeError: Cannot read property 'style' of undefined
    at Object.module.exports (/Users/jasonkuhrt/projects/react-popover/node_modules/css-vendor/lib/supported-value.js:27:7)
    at cssvalue (/Users/jasonkuhrt/projects/react-popover/lib/index.js:18:9)
    at Object.<anonymous> (/Users/jasonkuhrt/projects/react-popover/lib/index.js:25:12)
    at Module._compile (module.js:460:26)
    at normalLoader (/usr/local/lib/node_modules/babel/node_modules/babel-core/lib/api/register/node.js:199:5)
    at Object.require.extensions.(anonymous function) [as .js] (/usr/local/lib/node_modules/babel/node_modules/babel-core/lib/api/register/node.js:216:7)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)

But I may take a different strategy so don't worry about it... Thanks.

from css-vendor.

kof avatar kof commented on September 18, 2024

well this is because you actually use this plugin. What I was fixing is that you can't handle per environment setup because it throws before. Now you can, you just don't use the plugin serverside.

from css-vendor.

kof avatar kof commented on September 18, 2024

means
if (!NODE_ENV) jss.use(vendorPrefixer)

from css-vendor.

jasonkuhrt avatar jasonkuhrt commented on September 18, 2024

@kof Pardon me I tested against the wrong code. Looking again it appears to be working thanks.

from css-vendor.

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.