replace server-side less import statement to webpack require.
$ npm install server-less-loader --save-dev
add server-less-loader before any js-related loader
{
test: /\.babel$/,
loader: "babel!server-less-loader"
},
add serverLessLoader option in webpack.config.js
serverLessLoader: {
loader: 'importLess' // use any word except for 'require'
}
Before:
import React from 'react';
var styleFile = importLess('./a', __dirname);
export default class a extends React.Component {
...
After:
import React from 'react';
var styleFile = require('./a.less');
export default class a extends React.Component {
...