-
Notifications
You must be signed in to change notification settings - Fork 27.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move build directory outside of server folder #4565
Conversation
# Conflicts: # server/utils.js
next-typescript has to be updated to reflect the changes in You can now use |
throw new Error('include option is not provided to hot-self-accept-loader. Please upgrade all next-plugins to the latest version.') | ||
} | ||
|
||
const dir = options.include.find((d) => resourcePath.indexOf(d) === 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do the indexOf
outside of the predicate to a variable and use that in here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How'd you mean 🤔
import loaderUtils from 'loader-utils' | ||
|
||
module.exports = function (content, sourceMap) { | ||
type Options = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can this be an exact type? {||}
include: [ | ||
path.join(dir, 'pages') | ||
], | ||
extensions: /\.(js|jsx)$/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick, but how about jsx?
🏌️♂️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is intended to not confuse people reading the code.
lib/constants.js
Outdated
@@ -12,3 +13,9 @@ export const BLOCKED_PAGES = [ | |||
'/_app', | |||
'/_error' | |||
] | |||
export const IS_BUNDLED_PAGE = /^bundles[/\\]pages.*\.js$/ | |||
export const MATCH_ROUTE_NAME = /^bundles[/\\]pages[/\\](.*)\.js$/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not obvious that these are Regexs. what do you think about BUNDLE_PAGE_REGEX
and ROUTE_NAME_REGEX
?
readme.md
Outdated
- `buildId` - `String` the build id used as a unique identifier between builds | ||
- `dev` - `Boolean` shows if the compilation is done in development mode | ||
- `isServer` - `Boolean` shows if the resulting configuration will be used for server side (`true`), or client size compilation (`false`). | ||
- `defaultLoaders` - `Object` Holds loaders Next.js uses internally, so that you can use them in custom configuration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm confused. Does defaultLoaders
hold the loader objects themselves, or just the configuration objects for the loaders?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most of it looks great. Read comments above 👍
readme.md
Outdated
module.exports = { | ||
webpack: (config, {}) => { | ||
config.module.rules.push({ | ||
test: extension, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we say test: /mdx?/
for the example?
server/utils.js
Outdated
export function getChunkNameFromFilename (filename) { | ||
export function getChunkNameFromFilename (filename, dev) { | ||
if (dev) { | ||
return filename.replace(/.[^.]*$/, '') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
huh, is this because webpack handles naming different based on NODE_ENV
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, with chunk hash or without, but I didn't change this. It's from another PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
The prepares for next-server. I also took this as an opportunity to get all build directory paths from a single location, as they were previously scattered across webpack/babel plugins and loaders.
The prepares for next-server.
I also took this as an opportunity to get all build directory paths from a single location, as they were previously scattered across webpack/babel plugins and loaders.