Issue 1:
Please add some document why we add following configuration to less. check https://github.com/zeit/next.js/issues/7957 for details, I also create a reproduction demo

if (isServer) {
const antStyles = /antd\/.*?\/style.*?/;
const origExternals = [...config.externals];
config.externals = [
(context, request, callback) => {
if (request.match(antStyles)) {
return callback();
};
if (typeof origExternals[0] === 'function') {
origExternals[0](context, request, callback);
} else {
callback()
}
},
...(typeof origExternals[0] === 'function' ? [] : origExternals),
];

config.module.rules.unshift({
test: antStyles,
use: 'null-loader',
});
}

Why less files of Antd matching /antd\/.*?\/style.*?/ are excluded from server webpack?

Why they are excluded by webpack externals option, exclude them again by null-loader?

Since they are excluded why they are still loaded? that is why I have following error.

/Users/john/www/acme-admin-ui/node_modules/antd/lib/style/index.less:1
@import './themes/index';
^

SyntaxError: Invalid or unexpected token
at Module._compile (internal/modules/cjs/loader.js:718:23)
at Module._extensions..js (internal/modules/cjs/loader.js:785:10)
at Object.require.extensions.<computed> [as .js] (/Users/john/www/acme-admin-ui/node_modules/ts-node/src/index.ts:529:44)
at Module.load (internal/modules/cjs/loader.js:641:32)
at Function.Module._load (internal/modules/cjs/loader.js:556:12)
at Module.require (internal/modules/cjs/loader.js:681:19)
at require (internal/modules/cjs/helpers.js:16:16)
at Object.<anonymous> (/Users/john/www/acme-admin-ui/node_modules/antd/lib/layout/style/layout/style/index.jsx:1:1)
at Module._compile (internal/modules/cjs/loader.js:774:30)
at Module._extensions..js (internal/modules/cjs/loader.js:785:10)
at Object.require.extensions.<computed> [as .js] (/Users/john/www/acme-admin-ui/node_modules/ts-node/src/index.ts:529:44)
at Module.load (internal/modules/cjs/loader.js:641:32)
at Function.Module._load (internal/modules/cjs/loader.js:556:12)
at Module.require (internal/modules/cjs/loader.js:681:19)
at require (internal/modules/cjs/helpers.js:16:16)
at Object.<anonymous> (/Users/john/www/acme-admin-ui/node_modules/@ant-design/pro-layout/lib/BasicLayout.js:10:1)

@ant-design/pro-layout/lib/BasicLayout.js

"use strict";

function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }

Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;

require("antd/lib/layout/style"); //@ant-design/pro-layout/lib/BasicLayout.js:10:1. this line requires layout style which is supposed to be excluded by webpack, `antd/lib/layout/style` matches the regular expression above, so "@import" should not be resolved.

var _layout = _interopRequireDefault(require("antd/lib/layout"));

require("./BasicLayout.less");

I did everything as the example, it doesn't work in my enviroment, I search several hours, still don't figure out.

Issue 2:
I have searched the issues of this repository and believe that this is not a duplicate.

Expected Behavior

Asset files in static fold should be available on URL http://hostname/static/filename. For example, file static/hello.txt should be accessible by URL http://hostname/static/hello.txt.

Current Behavior

Requesting static file gets a 404 page.

Steps to Reproduce (for bugs)

Create minimal next app with next.js v2.4.8

add one txt file foo.txt in static folder

Try to access this txt file in browser by http://localhost/static/foo.txt.

Context

This bug happens in v2.4.8 but not in v2.4.7. It looks this bug is introduced by c03c86e . The build actually fails but it is still published as v2.4.8.

For the time being, I have to lock version on 2.4.6 or 2.4.7.

Your Environment

Tech
Version

next
2.4.8

node
v6.9.2

OS
MacOS 10.12.5 (16F73)

browser
Chrome 59