Use the same port in Module Federated React Application - reactjs

I've 3 applications which are embedded on the same spring service (built by yarn maven plugin) with the following configuration:
App Shell
module.exports = {
mode: 'production',
entry: './src/index',
cache: false,
devtool: false,
optimization: {
minimize: true,
},
output: {
publicPath: 'http://localhost:8000/gui/shell/',
clean: true,
pathinfo: false,
path: path.resolve(__dirname, 'build/'),
},
resolve: {
extensions: ['.tsx', '.ts', '.jsx', '.js', '.json'],
},
module: {
rules: [
{
test: /\.m?js/,
type: 'javascript/auto',
resolve: {
fullySpecified: false,
},
},
{
test: /\.css$/i,
use: [
'style-loader',
{
loader: 'css-loader',
options: {
modules: true,
},
},
],
},
{
test: /\.(ts|tsx|js|jsx)$/,
exclude: /node_modules/,
use: ['babel-loader'],
},
{
test: /\.svg$/,
use: [
{
loader: 'svg-url-loader',
options: {
limit: 10000,
},
},
],
},
{
test: /\.json$/,
loader: 'json-loader',
},
{
test: /\.s[ac]ss$/i,
use: [
// Creates `style` nodes from JS strings
'style-loader',
// Translates CSS into CommonJS
'css-loader',
// Compiles Sass to CSS
'sass-loader',
],
},
{
test: /\.(woff(2)?|ttf|eot)(\?v=\d+\.\d+\.\d+)?$/,
use: [
{
loader: 'file-loader',
options: {
name: '[name].[ext]',
outputPath: 'fonts/',
},
},
],
},
],
},
plugins: [
new ModuleFederationPlugin({
name: 'frontend_shell',
filename: 'remoteEntry.js',
remotes: {
store: 'store#http://localhost:8000/store/remoteEntry.js',
appOneRemote: 'appOneRemote#http://localhost:8000/appOneRemote/remoteEntry.js',
},
exposes: {
'./translate': './src/utility/i18n/translate.js',
'./useAllUserInfo': './src/hooks/useAllUserInfo.js',
'./useDarkMode': './src/hooks/useDarkMode.js',
},
shared: {
...deps,
react: {
singleton: true,
requiredVersion: deps.react,
eager: true,
},
'react-dom': {
singleton: true,
requiredVersion: deps['react-dom'],
eager: true,
},
},
}),
new HtmlWebPackPlugin({
template: './public/index.html',
inject: 'body',
hash: true,
minify: true,
}),
new ESLintPlugin({
extensions: ['js', 'jsx'],
}),
],
};
App remote 1
module.exports = {
mode: 'production',
entry: './src/index',
cache: false,
devtool: false,
optimization: {
minimize: true,
},
output: {
publicPath: 'http://localhost:8000/appOneRemote/',
clean: true,
pathinfo: false,
path: path.resolve(__dirname, 'build/'),
},
resolve: {
extensions: ['.js', '.mjs', '.jsx', '.css'],
alias: {
events: 'events',
},
},
module: {
rules: [
{
test: /\.m?js/,
type: 'javascript/auto',
resolve: {
fullySpecified: false,
},
},
{
test: /\.css$/i,
use: [
'style-loader', 'css-loader',
],
},
{
test: /\.(ts|tsx|js|jsx)$/,
exclude: /node_modules/,
use: ['babel-loader'],
},
{
test: /\.svg$/,
use: ['#svgr/webpack'],
},
{
test: /\.json$/,
loader: 'json-loader',
},
],
},
plugins: [
new ModuleFederationPlugin({
name: 'appOneRemote',
filename: 'remoteEntry.js',
remotes: {
store: 'store#http://localhost:8000/store/remoteEntry.js',
shell: 'frontend_shell#http://localhost:8000/gui/shell/remoteEntry.js',
},
exposes: {
'./ManageUser': './src/pages/ManageUser/ManageUser.jsx',
},
shared: {
...deps,
react: {
singleton: true,
requiredVersion: deps.react,
eager: true,
},
'react-dom': {
singleton: true,
requiredVersion: deps['react-dom'],
eager: true,
},
},
}),
new HtmlWebPackPlugin({
template: './public/index.html',
}),
new ESLintPlugin({
extensions: ['js', 'jsx'],
}),
],
};
App remote 2
module.exports = {
mode: 'production',
entry: './src/index',
cache: false,
devtool: false,
optimization: {
minimize: true,
},
output: {
publicPath: 'http://localhost:8000/store/',
clean: true,
pathinfo: false,
path: path.resolve(__dirname, 'build/'),
},
resolve: {
extensions: ['.tsx', '.ts', '.jsx', '.js', '.json'],
},
module: {
rules: [
{
test: /\.m?js/,
type: 'javascript/auto',
resolve: {
fullySpecified: false,
},
},
{
test: /\.(css|s[ac]ss)$/i,
use: ['style-loader', 'css-loader', 'postcss-loader'],
},
{
test: /\.(ts|tsx|js|jsx)$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
},
},
{
test: /\.json$/,
loader: 'json-loader',
},
],
},
plugins: [
new ModuleFederationPlugin({
name: 'store',
filename: 'remoteEntry.js',
remotes: {},
exposes: { './store': './src/store' },
shared: {
...deps,
react: {
singleton: true,
requiredVersion: deps.react,
},
'react-dom': {
singleton: true,
requiredVersion: deps['react-dom'],
},
'react-redux': {
singleton: true,
},
},
}),
new HtmlWebPackPlugin({
template: './public/index.html',
}),
new ESLintPlugin({
extensions: ['js', 'jsx'],
}),
],
};
This is exactly what I get in the console:
Warning:
Initialization of sharing external failed: ScriptExternalLoadError: Loading script failed.
(error: http://localhost:8000/appOneRemote/remoteEntry.js)
Warning:
Initialization of sharing external failed: ScriptExternalLoadError: Loading script failed.
(error: http://localhost:8000/store/remoteEntry.js)
Error:
Uncaught (in promise) ScriptExternalLoadError: Loading script failed.
(error: http://localhost:8000/store/remoteEntry.js)
while loading "./store" from 83878
at Object.83878 (main.js?1154643655f4125db28e:2:130241)
Also I can retrieve my shell remote entry here: http://localhost:8000/gui/shell/remoteEntry.js, but I got a 404 in the following:
http://localhost:8000/store/remoteEntry.js
http://localhost:8000/appOneRemote/remoteEntry.js
Any ideas?

Related

use sequential number for chunkFileName in webpack

I would like to use a sequential number such as 1.js, 2.js,... for chunkFileName in production mode of webpack v5. I set [index].js for naming but webpack gives me following error:
Error: Conflict: Multiple chunks emit assets to the same filename
[index].js (chunks 179 and 216)
Here's my config for webpack:
var config = {
devtool: 'eval-source-map',
cache: true,
entry: {
main: path.join(__dirname, "app", "App.js"),
},
output: {
path: path.join(__dirname, 'scripts', 'js'),
filename: '[name].js',
chunkFilename: '[name].js',
sourceMapFilename: '[file].map',
publicPath: '/scripts/js/'
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
babelrc: false,
presets: [
['es2015', { modules: false }],
'react',
],
plugins: [
'syntax-dynamic-import',
'transform-object-rest-spread',
'transform-class-properties',
'transform-object-assign',
],
}
},
},
{
// Preprocess our own .css files
// This is the place to add your own loaders (e.g. sass/less etc.)
// for a list of loaders, see https://webpack.js.org/loaders/#styling
test: /\.css$/,
exclude: /node_modules/,
use: [
'style-loader',
'css-loader',
]
}
],
},
optimization: {
minimize: false,
splitChunks: {
cacheGroups: {
defaultVendors: {
test: /[\\/]node_modules[\\/]/,
name: "vendors",
chunks: "all"
}
},
}
},
plugins: [
new CompressionPlugin({
algorithm: 'gzip',
test: /\.(js)$|\.(css)$|\.(html)$|\.eot?.+$|\.ttf?.+$|\.woff?.+$|\.svg?.+$/,
//threshold: 10240,
//minRatio: 0
})
],
resolve: {
extensions: ['.js', '.jsx', '.css', '.ts'],
alias: {
'react-loadable': path.resolve(__dirname, 'app/app.js'),
},
},
};
if (process.env.NODE_ENV === 'production') {
const TerserPlugin = require("terser-webpack-plugin");
config.devtool = false;
config.output.chunkFilename = '[index].js';
config.optimization = {
minimize: true,
minimizer: [new TerserPlugin()],
splitChunks: {
cacheGroups: {
vendors: {
test: /[\\/]node_modules[\\/]/,
name: "vendors",
chunks: "all",
}
},
}
},
config.plugins = [
new webpack.optimize.AggressiveMergingPlugin(),
new webpack.DefinePlugin({
'process.env': { NODE_ENV: JSON.stringify('production') }
}),
new CompressionPlugin({
algorithm: 'gzip',
test: /\.(js)$|\.(css)$|\.(html)$|\.eot?.+$|\.ttf?.+$|\.woff?.+$|\.svg?.+$/,
//threshold: 10240,
//minRatio: 0
})
];
}
module.exports = config;
Does anyone know where is the problem? Thank you in advance!
I've found my answer! There is a config for webpack's optimization section which can be set and it gives us a sequential numbers as chunkFileName and its chunkIds which should set to natural. So:
config.optimization = {
chunkIds: "natural",
minimize: true,
minimizer: [new TerserPlugin()],
splitChunks: {
cacheGroups: {
vendors: {
test: /[\\/]node_modules[\\/]/,
name: "vendors",
chunks: "all"
}
},
}
}

Computed Properties not working with Babel preset-env

I'm trying to use computed properties in my Material UI style object, but I've getting an unexpected token error.
Below is the code snippet, error, and babel-webpack config.
const useStyles = makeStyles(theme => {
root: {
[desktop]: {
width: "80%",
}
}
});
//webpack.config.babel.js
...
const config = {
entry: ['#babel/polyfill', './src/components/index.js'],
resolve: {
extensions: ['.js', '.jsx', '.ts', '.tsx'],
},
devServer: {
host: '0.0.0.0',
historyApiFallback: {
index: 'index.dev.html',
},
},
output: {
path: path.resolve(__dirname, 'build'),
filename: 'main.js',
chunkFilename: '[name].js',
publicPath: '/build/',
},
optimization: {
minimizer: [
new UglifyJsPlugin({
cache: true,
parallel: true,
sourceMap: true,
extractComments: true,
}),
new OptimizeCSSAssetsPlugin({}),
],
splitChunks: {
cacheGroups: {
default: false,
vendors: {
// name of the chunk
name: 'vendor',
// sync + async chunks
chunks: 'all',
// import file path containing node_modules
test: /node_modules/,
priority: 20,
},
styles: {
name: 'styles',
test: /\.css$/,
chunks: "all",
enforce: true,
},
common: {
name: 'common',
minChunks: 2,
chunks: 'all',
priority: 10,
reuseExistingChunk: true,
enforce: true,
},
},
},
},
module: {
rules: [
{
test: /\.(js|ts)x?$/,
exclude: /node_modules/,
loader: 'babel-loader',
options: {
presets: [
'#babel/typescript',
"#babel/preset-env",
'#babel/preset-react',
'#babel/preset-flow',
],
plugins: [
'#babel/plugin-transform-runtime',
'#babel/plugin-proposal-object-rest-spread',
['#babel/plugin-proposal-decorators', {legacy: true}],
['#babel/plugin-proposal-class-properties', {loose: true}],
['#babel/plugin-transform-computed-properties', {loose: true}],
],
},
},
{
test: /\.s?[ac]ss$/,
use: [
devMode ? 'style-loader' : MiniCssExtractPlugin.loader,
'css-loader',
'sass-loader',
],
},
],
},
node: {
fs: 'empty',
},
// First array is dev only, second is production
plugins: devMode
? [
] : [
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('production'),
}),
new MiniCssExtractPlugin({
filename: '[name].css'
}),
],
};
// Exports
module.exports = config;
at Object.raise (/node_modules/#babel/parser/lib/index.js:6931:17)
at Object.unexpected (/node_modules/#babel/parser/lib/index.js:8324:16)
at Object.semicolon (/node_modules/#babel/parser/lib/index.js:8306:40)
at Object.parseExpressionStatement (/node_modules/#babel/parser/lib/index.js:11147:10)
at Object.parseExpressionStatement (/node_modules/#babel/parser/lib/index.js:2072:18)
at Object.parseStatementContent (/node_modules/#babel/parser/lib/index.js:10746:19)
at Object.parseStatement (/node_modules/#babel/parser/lib/index.js:10612:17)
at Object.parseStatement (/node_modules/#babel/parser/lib/index.js:2045:26)
at Object.parseBlockOrModuleBlockBody (/node_modules/#babel/parser/lib/index.js:11188:25)
at Object.parseBlockBody (/node_modules/#babel/parser/lib/index.js:11175:10)
at Object.parseBlock (/node_modules/#babel/parser/lib/index.js:11159:10)
at Object.parseStatementContent (/node_modules/#babel/parser/lib/index.js:10688:21)
at Object.parseStatement (/node_modules/#babel/parser/lib/index.js:10612:17)
at Object.parseStatement (/node_modules/#babel/parser/lib/index.js:2045:26)
at Object.parseLabeledStatement (/node_modules/#babel/parser/lib/index.js:11139:22)
at Object.parseStatementContent (/node_modules/#babel/parser/lib/index.js:10744:19)
Well this was a simple mistake. I didn't enclose my object in parentheses (missing return).
const useStyles = makeStyles((theme) => ({
root: {
[desktop]: {
...
}
}
}));

[Webpack][React] On SSR with code-splitting how I can get the list of chunks needed by the page?

I've a React application with perfectly working SSR and Webpack code-splitting.
My webpack.config.js looks like this:
const webpack = require('webpack');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const ServerMiniCssExtractPlugin = require("./server/utils/serverMiniCssExtractPlugin");
module.exports = [{
name: 'react-app',
mode: 'development',
devtool: 'eval',
cache: true,
entry: {
main: [
'babel-polyfill',
'webpack-hot-middleware/client',
'./react/index.tsx',
],
},
output: {
path: `${__dirname}/dist/__build__`,
filename: '[name].js',
chunkFilename: '[name].js',
publicPath: '/__build__/',
},
module: {
rules: [{
test: /\.(ts|js)x?$/,
loader: 'babel-loader',
exclude: [/node_modules/],
}, {
test: /\.scss$/,
oneOf: [{
resourceQuery: /^\?raw$/,
use: [MiniCssExtractPlugin.loader, {
loader: 'css-loader',
options: {
modules: true,
sourceMap: true,
camelCase: false,
localIdentName: '[local]',
},
}, 'sass-loader', 'postcss-loader'],
}, {
use: [MiniCssExtractPlugin.loader, {
loader: 'css-loader',
options: {
modules: true,
sourceMap: true,
camelCase: true,
localIdentName: '[path]___[name]__[local]___[hash:base64:5]',
},
}, 'sass-loader', 'postcss-loader'],
}]
}],
},
resolve: {
extensions: ['.ts', '.tsx', '.js'],
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new webpack.NamedModulesPlugin(),
new webpack.DefinePlugin({
'process.env': {
CLIENT: JSON.stringify(true),
},
}),
new webpack.IgnorePlugin(/^vertx$/),
new MiniCssExtractPlugin({
filename: "style.css",
chunkFilename: "style.chunk.[id].css"
}),
],
optimization: {
splitChunks: {
cacheGroups: {
vendor: {
test: /node_modules/,
name: 'vendor',
enforce: true
},
},
},
},
}, {
name: 'server-side rendering',
mode: 'development',
devtool: 'eval',
cache: true,
entry: [
'./react/ssr.tsx',
],
target: 'node',
output: {
path: `${__dirname}/dist/__server__/`,
filename: 'ssr.js',
publicPath: '/__server__/',
libraryTarget: 'commonjs2',
},
resolve: {
extensions: ['.ts', '.tsx', '.js'],
},
module: {
rules: [{
test: /\.(ts|js)x?$/,
exclude: [/node_modules/, /.+\.config.js/],
loader: 'babel-loader',
}, {
test: /\.scss$/,
oneOf: [{
resourceQuery: /^\?raw$/,
use: [ServerMiniCssExtractPlugin.loader, {
loader: 'css-loader',
options: {
modules: true,
sourceMap: true,
camelCase: false,
localIdentName: '[local]',
},
}, 'sass-loader', 'postcss-loader'],
}, {
use: [ServerMiniCssExtractPlugin.loader, {
loader: 'css-loader',
options: {
modules: true,
sourceMap: true,
camelCase: true,
localIdentName: '[path]___[name]__[local]___[hash:base64:5]',
},
}, 'sass-loader', 'postcss-loader'],
}]
}],
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new webpack.NamedModulesPlugin(),
new webpack.DefinePlugin({
'process.env': {
SERVER: JSON.stringify(true),
},
}),
new webpack.IgnorePlugin(/^vertx$/),
new ServerMiniCssExtractPlugin({
filename: "style.css",
chunkFilename: "style.chunk.[id].css"
}),
],
}];
... and it generates chunks for both js and css that using the app are loaded correctly when moving from the different pages, all mapped with react-router.
The problem is that when I reload one of the pages the needed css chunks are loaded once rendered and not linked directly in the page from the SSR, so for a second I have FOUC.
Since I would like using React-Helmet to inject in the page head the needed css chunks when I SSR the app how I can get in the code the list of chunks file names that are needed for the page that I reload?
Let say that the page needs:
0.js
2.js
style.chunk.0.css
style.chunk.2.css
How I can get the list of these files so I can generate dynamically the links in the page head?
Thanks.
Use the webpack-manifest-plugin to generate a manifest.json file that will include a list of all your chunks.
In your webpack.config.js:
var ManifestPlugin = require('webpack-manifest-plugin');
module.exports = {
// ...
plugins: [
new ManifestPlugin()
]
};
This will generate a manifest.json file in your root output directory with a mapping of all source file names to their corresponding output file, for example:
{
"mods/alpha.js": "mods/alpha.1234567890.js",
"mods/omega.js": "mods/omega.0987654321.js"
}

webpack config not emitting css in build folder

Here is my config for webpack production mode.
const serverConfig = {
//mode: "production",
optimization: {
//minimize: true,
splitChunks: {
chunks: "async",
cacheGroups: {
commons: {
test: /[\\/]node_modules[\\/]/,
name: "vendor",
chunks: "all",
},
// server: {
// name: "server",
// chunks: "all",
// enforce: true,
// },
// flightsDesktop: {
// name: "flightsDesktop",
// test: (m, c, entry = "flightsDesktop") => m.constructor.name === "CssModule" && recursiveIssuer(m) === entry,
// chunks: "all",
// enforce: true,
// },
},
},
minimizer: [
new UglifyJsPlugin({
uglifyOptions: {
compress: true,
ecma: 6,
output: {
comments: false,
},
compess: {
dead_code: true,
drop_console: true,
},
},
sourceMap: false,
}),
],
},
entry: {
server: path.resolve(__dirname, "../script/server_script.js"),
flightsDesktop: cssHelper.getFlightsDesktopHomeCss(__dirname),
hotelsDesktop: cssHelper.getHotelsDesktopHomeCss(__dirname),
homestaysDesktop: cssHelper.getHomestayDesktopHomeCss(__dirname),
holidaysDesktop: cssHelper.getHolidayDesktopHomeCss(__dirname),
flightsAdaptive: cssHelper.getFlightsAdaptiveHomeCss(__dirname),
hotelsAdaptive: cssHelper.getHotelsAdaptiveHomeCss(__dirname),
homestaysAdaptive: cssHelper.getHomestayAdaptiveHomeCss(__dirname),
holidaysAdaptive: cssHelper.getHolidayAdaptiveHomeCss(__dirname),
experiencesDesktop: cssHelper.getExperiencesDesktopHomeCss(__dirname),
experiencesAdaptive: cssHelper.getExperiencesAdaptiveHomeCss(__dirname),
hotelsSEODesktop: cssHelper.getHotelsSEODesktopCss(__dirname),
hotelsSEOAdaptive: cssHelper.getHotelsSEOAdaptiveCss(__dirname),
trainsDesktop: cssHelper.getTrainsDesktopHomeCss(__dirname),
trainsAdaptive: cssHelper.getTrainsAdaptiveHomeCss(__dirname),
},
target: "node",
output: {
// path: path.join(__dirname, "../build"),
// filename: "[name].js",
//libraryTarget: "commonjs2",
path: path.join(__dirname, "../build"),
// Generated JS file names (with nested folders).
// There will be one main bundle, and one file per asynchronous chunk.
// We don't currently advertise code splitting but Webpack supports it.
filename: "[name].js",
//chunkFilename: "static/js/[name].[hash:8].chunk.js",
// We inferred the "public path" (such as / or /my-project) from homepage.
publicPath,
},
module: {
rules: [
{
exclude: [
/\.html$/,
/\.(js|jsx)$/,
/\.css$/,
/\.json$/,
/\.svg$/,
],
// loader, query and exclude
loader: "url-loader",
options: {
limit: 10000,
name: "/static/media/[name].[hash:8].[ext]",
},
},
{
test: /\.svg$/,
loader: "file-loader",
options: {
name: "/static/media/[name].[hash:8].[ext]",
},
},
{
test: /\.css$/,
use: [
"style-loader",
MiniCssExtractPlugin.loader,
{
loader: "css-loader",
options: {
importLoaders: 1,
minimize: true,
},
},
"postcss-loader",
"sass-loader",
],
// Note: this won't work without `new ExtractTextPlugin()` in `plugins`.
},
{
test: /\.scss$/,
use: [
// MiniCssExtractPlugin.loader,
{
loader: "css-loader/locals",
},
],
},
{
test: /\.(js|jsx)$/,
exclude: /(node_modules)/,
loader: "babel-loader",
query: { presets: ["react", "es2016", "es2015"], plugins: ["transform-class-properties"] },
},
],
},
plugins: [
new webpack.DefinePlugin(env),
//new WriteFilePlugin(),
// This helps ensure the builds are consistent if source hasn't changed:
new webpack.optimize.OccurrenceOrderPlugin(),
// Try to dedupe duplicated modules, if any:
// new webpack.optimize.DedupePlugin(),
// Minify the code.
// new webpack.optimize.UglifyJsPlugin({
// compress: {
// screw_ie8: true, // React doesn't support IE8
// warnings: false,
// },
// mangle: {
// screw_ie8: true,
// },
// output: {
// comments: false,
// screw_ie8: true,
// },
// }),
//new UglifyJsPlugin(),
new MiniCssExtractPlugin({
filename: "[name].css",
chunkFilename: "[id].css",
path: "static/css/",
}),
//new ExtractTextPlugin("static/css/[name].css"),
new webpack.LoaderOptionsPlugin({
options: {
postcss: [
autoprefixer({
browsers: [
">1%",
"last 4 versions",
"Firefox ESR",
"not ie < 9", // React doesn't support IE8 anyway
],
}),
],
},
}),
],
resolve: {
modules: ["src", "node_modules"],
},
}
module.exports = [serverConfig]
I am miising something obvious, what wrong I am doing?

Next.js: Webpack ExtractTextPlugin not extracting scss in nodes_modules with next-sass

I have starting a new project with Next, and my main problem is the following:
My app composes external components that are transpiled and installed via npm. this components require sass files
I use the simple withSass module provided by the Zeit team so I can include these component in my app
I get the following error:
/Users/antoine/react-platform/website-gamma/node_modules/star-rating/src/styles/style.scss:1
(function (exports, require, module, __filename, __dirname) { #import "_vars";
SyntaxError: Invalid or unexpected token
My interpretation might be wrong, but it looks like the loaders worked but the ExtractTextPlugin has not replace anything.
here is my next.config.js:
module.exports = withSass({
cssModules: true,
cssLoaderOptions: {
importLoaders: 1,
localIdentName: "[local]___[hash:base64:5]"
}
});
And here is my Webpack config (client and then server):
{ devtool: 'source-map',
name: 'client',
cache: true,
target: 'web',
externals: [],
context: '/Users/antoine/react-platform/website-gamma',
entry: [Function: entry],
output:
{ path: '/Users/antoine/react-platform/website-gamma/.next',
filename: '[name]',
libraryTarget: 'commonjs2',
chunkFilename: '[name]-[chunkhash].js',
strictModuleExceptionHandling: true,
devtoolModuleFilenameTemplate: '[absolute-resource-path]' },
performance: { hints: false },
resolve:
{ extensions: [ '.js', '.jsx', '.json' ],
modules:
[ '/Users/antoine/react-platform/website-gamma/node_modules/next/node_modules',
'node_modules',
'/home/antoine/npm/lib/node_modules' ],
alias:
{ next: '/Users/antoine/react-platform/website-gamma/node_modules/next',
'react$': 'react/cjs/react.development.js',
'react-dom$': 'react-dom/cjs/react-dom.development.js' } },
resolveLoader:
{ modules:
[ '/Users/antoine/react-platform/website-gamma/node_modules/next/node_modules',
'node_modules',
'/Users/antoine/react-platform/website-gamma/node_modules/next/dist/server/build/loaders',
'/home/antoine/npm/lib/node_modules' ] },
module:
{ rules:
[ { test: /\.(js|jsx)(\?[^?]*)?$/,
loader: 'hot-self-accept-loader',
include:
[ '/Users/antoine/react-platform/website-gamma/pages',
'/Users/antoine/react-platform/website-gamma/node_modules/next/pages' ] },
{ test: /\.+(js|jsx)$/,
include: [ '/Users/antoine/react-platform/website-gamma' ],
exclude: /node_modules/,
use:
{ loader: 'babel-loader',
options:
{ cacheDirectory: true,
presets: [],
plugins:
[ '/Users/antoine/react-platform/website-gamma/node_modules/react-hot-loader/babel.js' ],
babelrc: true } } },
{ test: /\.scss$/,
use:
[ 'extracted-loader',
{ loader: '/Users/antoine/react-platform/website-gamma/node_modules/extract-text-webpack-plugin/dist/loader.js',
options: { id: 1, omit: 0, remove: true } },
{ loader: 'css-loader',
options:
{ modules: true,
minimize: false,
sourceMap: true,
importLoaders: 1,
localIdentName: '[local]___[hash:base64:5]' } },
{ loader: 'sass-loader', options: {} } ] },
{ test: /\.sass$/,
use:
[ 'extracted-loader',
{ loader: '/Users/antoine/react-platform/website-gamma/node_modules/extract-text-webpack-plugin/dist/loader.js',
options: { id: 1, omit: 0, remove: true } },
{ loader: 'css-loader',
options:
{ modules: true,
minimize: false,
sourceMap: true,
importLoaders: 1,
localIdentName: '[local]___[hash:base64:5]' } },
{ loader: 'sass-loader', options: {} } ] } ] },
plugins:
[ NoEmitOnErrorsPlugin {},
FriendlyErrorsWebpackPlugin {
compilationSuccessInfo: {},
onErrors: undefined,
shouldClearConsole: true,
formatters: [ [Function: format], [Function: format], [Function: format] ],
transformers:
[ [Function: transform],
[Function: transform],
[Function: transform] ] },
NamedModulesPlugin { options: {} },
HotModuleReplacementPlugin {
options: {},
multiStep: undefined,
fullBuildTimeout: 200,
requestTimeout: 10000 },
UnlinkFilePlugin { prevAssets: {} },
CaseSensitivePathsPlugin { options: {}, pathCache: {}, fsOperations: 0, primed: false },
LoaderOptionsPlugin {
options:
{ options:
{ context: '/Users/antoine/react-platform/website-gamma',
customInterpolateName: [Function: customInterpolateName] },
test: { test: [Function: test] } } },
{ apply: [Function: apply] },
DefinePlugin { definitions: { 'process.env.NODE_ENV': '"development"' } },
PagesPlugin {},
DynamicChunksPlugin {},
CommonsChunkPlugin {
chunkNames: [ 'manifest' ],
filenameTemplate: 'manifest.js',
minChunks: undefined,
selectedChunks: undefined,
children: undefined,
deepChildren: undefined,
async: undefined,
minSize: undefined,
ident: '/Users/antoine/react-platform/website-gamma/node_modules/webpack/lib/optimize/CommonsChunkPlugin.js0' },
ExtractTextPlugin { filename: 'static/style.css', id: 1, options: {} } ] }
--------
{ devtool: 'source-map',
name: 'server',
cache: true,
target: 'node',
externals: [ [Function] ],
context: '/Users/antoine/react-platform/website-gamma',
entry: [Function: entry],
output:
{ path: '/Users/antoine/react-platform/website-gamma/.next/dist',
filename: '[name]',
libraryTarget: 'commonjs2',
chunkFilename: '[name]-[chunkhash].js',
strictModuleExceptionHandling: true,
devtoolModuleFilenameTemplate: '[absolute-resource-path]' },
performance: { hints: false },
resolve:
{ extensions: [ '.js', '.jsx', '.json' ],
modules:
[ '/Users/antoine/react-platform/website-gamma/node_modules/next/node_modules',
'node_modules',
'/home/antoine/npm/lib/node_modules' ],
alias:
{ next: '/Users/antoine/react-platform/website-gamma/node_modules/next',
'react$': 'react/cjs/react.development.js',
'react-dom$': 'react-dom/cjs/react-dom.development.js' } },
resolveLoader:
{ modules:
[ '/Users/antoine/react-platform/website-gamma/node_modules/next/node_modules',
'node_modules',
'/Users/antoine/react-platform/website-gamma/node_modules/next/dist/server/build/loaders',
'/home/antoine/npm/lib/node_modules' ] },
module:
{ rules:
[ { test: /\.+(js|jsx)$/,
include: [ '/Users/antoine/react-platform/website-gamma' ],
exclude: /node_modules/,
use:
{ loader: 'babel-loader',
options: { cacheDirectory: true, presets: [], plugins: [], babelrc: true } } },
{ test: /\.scss$/,
use:
[ { loader: 'css-loader/locals',
options:
{ modules: true,
minimize: false,
sourceMap: true,
importLoaders: 1,
localIdentName: '[local]___[hash:base64:5]' } },
{ loader: 'sass-loader', options: {} } ] },
{ test: /\.sass$/,
use:
[ { loader: 'css-loader/locals',
options:
{ modules: true,
minimize: false,
sourceMap: true,
importLoaders: 1,
localIdentName: '[local]___[hash:base64:5]' } },
{ loader: 'sass-loader', options: {} } ] } ] },
plugins:
[ NoEmitOnErrorsPlugin {},
NamedModulesPlugin { options: {} },
UnlinkFilePlugin { prevAssets: {} },
CaseSensitivePathsPlugin { options: {}, pathCache: {}, fsOperations: 0, primed: false },
LoaderOptionsPlugin {
options:
{ options:
{ context: '/Users/antoine/react-platform/website-gamma',
customInterpolateName: [Function: customInterpolateName] },
test: { test: [Function: test] } } },
{ apply: [Function: apply] },
DefinePlugin { definitions: { 'process.env.NODE_ENV': '"development"' } },
NextJsSsrImportPlugin {},
ExtractTextPlugin { filename: 'static/style.css', id: 2, options: {} } ] }

Resources