next-transpile-modules
Advanced tools
Comparing version 2.0.0 to 2.1.0
@@ -64,2 +64,3 @@ const path = require('path'); | ||
// that are going to be transpiled) | ||
// https://github.com/zeit/next.js/blob/815f2e91386a0cd046c63cbec06e4666cff85971/packages/next/server/hot-reloader.js#L335 | ||
const ignored = config.watchOptions.ignored.filter( | ||
@@ -70,2 +71,7 @@ regexp => !regexEqual(regexp, /[\\/]node_modules[\\/]/) | ||
config.watchOptions.ignored = ignored; | ||
if (typeof nextConfig.webpackDevMiddleware === 'function') { | ||
return nextConfig.webpackDevMiddleware(config); | ||
} | ||
return config; | ||
@@ -72,0 +78,0 @@ } |
{ | ||
"name": "next-transpile-modules", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"main": "index.js", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -40,3 +40,3 @@ # Next.js + Transpile `node_modules` | ||
With `next-typescript`: | ||
Example with `next-typescript`: | ||
@@ -54,2 +54,20 @@ ```js | ||
With `next-compose-plugins`: | ||
```js | ||
const withPlugins = require('next-compose-plugins'); | ||
const withTypescript = require('@zeit/next-typescript'); | ||
const withTM = require('next-transpile-modules'); | ||
module.exports = withPlugins([ | ||
[withTM, { | ||
transpileModules: ['some-module', 'and-another'], | ||
}], | ||
withTypescript, | ||
], { | ||
// ... | ||
}); | ||
``` | ||
## FAQ | ||
@@ -76,3 +94,3 @@ | ||
Lerna's purpose is to publish different packages from a monorepo, **it does not help for and do not intend to help local development with local modules**. | ||
Lerna's purpose is to publish different packages from a monorepo, **it does not help for and does not intend to help local development with local modules**. | ||
@@ -82,1 +100,23 @@ This is not coming from me, but [from Lerna's maintainer](https://github.com/lerna/lerna/issues/1243#issuecomment-401396850). | ||
So you are probably [using it wrong](https://github.com/martpie/next-transpile-modules/issues/5#issuecomment-441501107), and I advice you to use `npm` or Yarn workspaces instead. | ||
### But... I really need to make it work with Lerna! | ||
You may need to tell your Webpack configuration how to properly resolve your scoped packages, as they won't be installed in your Next.js directory, but the root of your Lerna setup. | ||
```js | ||
const withTM = require('next-transpile-modules'); | ||
module.exports = withTM({ | ||
transpileModules: ['@your-project/shared', '@your-project/styleguide'], | ||
webpack: (config, options) => { | ||
config.resolve.alias = { | ||
...config.resolve.alias, | ||
// Will make webpack look for these modules in parent directories | ||
'@your-project/shared': require.resolve('@your-project/shared'), | ||
'@your-project/styleguide': require.resolve('@your-project/styleguide'), | ||
// ... | ||
}; | ||
return config; | ||
}, | ||
}); | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8502
66
119