moxystudio / next-compile-node-modules Goto Github PK
View Code? Open in Web Editor NEWNext.js plugin to compile all node_modules using Babel
License: MIT License
Next.js plugin to compile all node_modules using Babel
License: MIT License
Hi there, I would like to hear you about why use your package instead of next-transpile-modules.
Do you mind sharing some details?
There's some istanbul ignore lines, remove them and add tests for them.
When using withCompileNodeModules
without the exclude
key defined, or without arguments, the webpack doesn't accept the configuration.
From what I can gather, in order to combine the exclude
defined in the options
object and the default configuration, we do this:
exclude: [
...toArray(ruleOptions.exclude),
// Next.js >= v9.1.5 is now inlining statements through `babel-plugin-transform-define`, see https://github.com/zeit/next.js/blob/d64587e1a3af11411a6c458ae9544950dfba7825/packages/next/build/webpack/loaders/next-babel-loader.js#L185
// However, the `process.browser` inlining was causing problems with Webpack builtin
// `node-libs-browser` (mock) and `node-process`
/[\\/]node_modules[/\\](node-libs-browser|process)[/\\]/,
],
However, if exclude
is not defined in the options
object, we will be spreading an array [undefined]
, which will cause the first element of the array in the final exclude
option to be undefined
, causing the webpack process to fail.
We need to change this to a conditional spread.
Next's latest versions have MultiThread optimization implemented: https://github.com/vercel/next.js/blob/435bf657847329c753b6c0633f6580a62dddb8ba/packages/next/build/webpack-config.ts#L753
This package should support these updates. In order to do this, the cache-loader config should be changed.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.