https://github.com/adrianmcli/nextjs-symlink-bug
https://github.com/adrianmcli/nextjs-symlink-bug
Last synced: 6 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/adrianmcli/nextjs-symlink-bug
- Owner: adrianmcli
- Created: 2017-10-25T03:28:28.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-10-28T09:56:31.000Z (over 8 years ago)
- Last Synced: 2025-01-17T04:44:26.482Z (about 1 year ago)
- Language: JavaScript
- Size: 44.9 KB
- Stars: 3
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Next.js Symlink Bug Demonstration (solution found!)
Next.js seems to have trouble importing from modules within symlinked folders. In this example repo, I've demonstrated this by putting two folders inside the `lib` directory: `symlink-folder` and `normal-folder`.
Inside each of these folders is a near-identical javascript file that exports a simple object. There is only one page, `index.js` that will read from this and display the text.
# Solution
According to [this Github issue comment](https://github.com/webpack/webpack/issues/1643#issuecomment-317436595), I needed to set `resolve.symlinks: false` in my webpack configuration. So that's exactly what I did inside `next.config.js`:
```js
module.exports = {
webpack: (config, { buildId, dev }) => {
config.resolve.symlinks = false
return config
}
}
```
And now it works.