-
Notifications
You must be signed in to change notification settings - Fork 170
Build via webpack #1687
Comments
Hi igorschoester, I don't know if this is the right issue to post this in or whether we should open a new issue. For the Drupal module that uses your library I'm trying to compile YoastSEO using Webpack. The imports are a good first start (I did run into #1878 ). However, building this with Webpack and Babel is currently impossible because the project requires keeping too many files in memory at the same time.
I've tried converting all the Are there any plans to convert the internal code for YoastSEO to also use import statements instead of require statements? If you're aware of a different solution without conversion then that would also be great. You can check out the out of memory error by cloning https://github.com/goalgorilla/RTSEO.js/tree/feature/improved-build-pipeline and running EDIT: It appears that in the current situation the version that's published on NPM exposes an index file that uses ES6 style exports and thus require transpilation. However, all the internals on NPM are already compiled which causes a huge overhead when trying to transpile again using Babel (I initially experienced this with babelify before trying Webpack with babel-loader). Letting Yarn install directly from the Github repository so that the original ES6 source is available allows the compilation to work as expected 👍 It would be nice if the original ES6 source could also be available through NPM (I'm not sure how other projects such as React handle this). The following issues still need to be resolved however (they are output as Webpack warnings):
~ Alexander |
Babel can't handle files that have been compiled previously by Babel because it contains too much duplication. Luckily the source of the YoastSEO library is still available in the repository which Babel can use with webpack to compile just fine. See Yoast/YoastSEO.js#1687 (comment)
The |
@Kingdutch #1919 covers your short-term issue. I've put that in our process to review. #1930 should cover the longer term issue. |
Current situation
The build is done via grunt. Which actually build all the JavaScript with the typescript builder. (and twice because of the templates).
Wanted situation
Use webpack. This will allow us to specify loaders for each type.
How we found out:
With the webworker we found out about this because we kept running into require / import problems. The code generated by TypeScript is not having a helper around the fact that a require could live inside a
.default
space. Which webpack does do properly. Also, the worker is created with the assumption of the worker-loader, which is not currently being done in the built. So thejs
file created does not work on the fly.The text was updated successfully, but these errors were encountered: