Skip to content
This repository has been archived by the owner on Dec 3, 2018. It is now read-only.

webpack uses ES6 and not umd/commonJS #69

Closed
Gregoirevda opened this issue Jul 19, 2018 · 8 comments
Closed

webpack uses ES6 and not umd/commonJS #69

Gregoirevda opened this issue Jul 19, 2018 · 8 comments

Comments

@Gregoirevda
Copy link

We use a npm package as a dependency which has 3 entry points:
https://github.com/apollographql/graphql-tag/blob/master/package.json#L5
main, module and jsnext:main
for some reason, it is using the ES6 module or jsnext:main entry point, which uses a undefined require import statement.

Related issue:
apollographql/reason-apollo#95

@rrdelaney
Copy link
Owner

Our webpack config is based off of react-script's, and we're not likely to deviate from that.

Is there a reason you need all 3 entry points?

@Gregoirevda
Copy link
Author

The 3 entry points are defined in the package.json of a dependency.
Can you confirm me it'll pick the jsnext:main as the entry point?

@rrdelaney
Copy link
Owner

I’m not really sure about the resolution between the three. I recommend playing around with CRA main if you’re unsure. We use the same dependency resultion and webpack config, except we add bs-loader.

@br1anchen
Copy link

@Gregoirevda @rrdelaney I believe it is similar issue related to this, I changed resolve extension order in webpack.config.dev.js from:

    extensions: ['.re', '.ml', '.web.js', '.mjs', '.js', '.json', '.web.jsx', '.jsx'],

to

    extensions: ['.re', '.ml', '.web.js', '.js', '.mjs', '.json', '.web.jsx', '.jsx'],

then it compiled with reason-apollo.
Currently reason-scripts is using "webpack": "3.8.1",, I think it does not probably support EcmaScript modules yet.
@rrdelaney is it straight forward to upgrade webpack to v4 to sync with current react-scripts dependencies in this case?

@Gregoirevda
Copy link
Author

Tried making a new project pointing on fixed react-scripts 1.1.2, but still have this issue.
Is this project using the latest webpack release?
graphql/graphql-js#1248 (comment)

@rrdelaney
Copy link
Owner

reason-scripts isn't going to be updated, or really support much anymore. I recommend using Parcel with BSB.

Closing this because this won't be updated.

@Anahkiasen
Copy link

Anahkiasen commented Dec 2, 2018

@rrdelaney You should add a warning about this in the main README and mark this package as deprecated in the meantime if it not going to get more updates. I don't think it's clear to a lot of people at the moment that this package is abandoned.

In addition to that I've never managed to make Parcel work on a my ReasonReact codebase, there's always some dependency or compilation error, have you had more success on your end?

@rrdelaney
Copy link
Owner

@Anahkiasen shoot yea, forgot to do that when I moved it out of reasonml-old

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants