@preconstruct/next
Advanced tools
Comparing version
# @preconstruct/next | ||
## 1.0.0 | ||
### Major Changes | ||
- [`4b4e558`](https://github.com/preconstruct/preconstruct/commit/4b4e55859f5dc474f26a44716f9e258fe374837d) Thanks [@mitchellhamilton](https://github.com/mitchellhamilton)! - Make Next use a custom Babel config even if it's in different higher directory than the Next site with `rootMode: 'upward-optional'` | ||
## 0.1.1 | ||
@@ -4,0 +10,0 @@ |
24
index.js
@@ -5,7 +5,23 @@ module.exports = (nextConfig = {}) => { | ||
nextConfig.webpack = (webpackConfig, options) => { | ||
webpackConfig.module.rules.push({ | ||
test: /\.+(js|jsx|ts|tsx)$/, | ||
use: options.defaultLoaders.babel, | ||
exclude: modulePath => /node_modules/.test(modulePath) | ||
let hasFoundRule = false; | ||
options.defaultLoaders.babel.options.rootMode = "upward-optional"; | ||
debugger; | ||
webpackConfig.module.rules.forEach(rule => { | ||
if ( | ||
rule.use === options.defaultLoaders.babel || | ||
(Array.isArray(rule.use) && | ||
rule.use.includes(options.defaultLoaders.babel)) | ||
) { | ||
hasFoundRule = true; | ||
debugger; | ||
delete rule.include; | ||
debugger; | ||
} | ||
}); | ||
if (!hasFoundRule) { | ||
throw new Error( | ||
"If you see this error, please open an issue with your Next.js version and @preconstruct/next version. The Next Babel loader could not be found" | ||
); | ||
} | ||
debugger; | ||
return originalWebpack | ||
@@ -12,0 +28,0 @@ ? originalWebpack(webpackConfig, options) |
{ | ||
"name": "@preconstruct/next", | ||
"version": "0.1.1", | ||
"version": "1.0.0", | ||
"description": "A Next.js plugin to work with preconstruct repos", | ||
@@ -5,0 +5,0 @@ "files": [ |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
2471
50.4%30
114.29%1
-50%