Currently doing maintenance for a project that was running React v15. Upgraded Webpack 3 > 4, Babel 6 > 7, css-loader 0.28.x > 3.0.0, etc.
Initially, updated React and used all the react-codemod + jscodeshift to transform the js files. While the version at that stage was not stable, it loaded and showed the proper styles etc.
What I find odd, is that after updating file-loader, css-loader, babel, and related packages, I kept getting Module not found: Error: Can't resolve, as following:
ERROR in ./app/sharedComponents/TitleGeneric/style.css (./node_modules/css-loader/dist/cjs.js??ref--6-1!./app/sharedComponents/TitleGeneric/style.css)
Module not found: Error: Can't resolve './sharedStyles/typography.css' in '/Users/userX/www/my-project-ui/app/sharedComponents/TitleGeneric'
resolve './sharedStyles/typography.css' in '/Users/userX/www/my-project-ui/app/sharedComponents/TitleGeneric'
using description file: /Users/userX/www/my-project-ui/package.json (relative path: ./app/sharedComponents/TitleGeneric)
Field 'browser' doesn't contain a valid alias configuration
using description file: /Users/userX/www/my-project-ui/package.json (relative path: ./app/sharedComponents/TitleGeneric/sharedStyles/typography.css)
no extension
Field 'browser' doesn't contain a valid alias configuration
/Users/userX/www/my-project-ui/app/sharedComponents/TitleGeneric/sharedStyles/typography.css doesn't exist
.wasm
Field 'browser' doesn't contain a valid alias configuration
/Users/userX/www/my-project-ui/app/sharedComponents/TitleGeneric/sharedStyles/typography.css.wasm doesn't exist
.mjs
Field 'browser' doesn't contain a valid alias configuration
/Users/userX/www/my-project-ui/app/sharedComponents/TitleGeneric/sharedStyles/typography.css.mjs doesn't exist
.js
Field 'browser' doesn't contain a valid alias configuration
/Users/userX/www/my-project-ui/app/sharedComponents/TitleGeneric/sharedStyles/typography.css.js doesn't exist
.json
Field 'browser' doesn't contain a valid alias configuration
/Users/userX/www/my-project-ui/app/sharedComponents/TitleGeneric/sharedStyles/typography.css.json doesn't exist
as directory
/Users/userX/www/my-project-ui/app/sharedComponents/TitleGeneric/sharedStyles/typography.css doesn't exist
[/Users/userX/www/my-project-ui/app/sharedComponents/TitleGeneric/sharedStyles/typography.css]
[/Users/userX/www/my-project-ui/app/sharedComponents/TitleGeneric/sharedStyles/typography.css.wasm]
[/Users/userX/www/my-project-ui/app/sharedComponents/TitleGeneric/sharedStyles/typography.css.mjs]
[/Users/userX/www/my-project-ui/app/sharedComponents/TitleGeneric/sharedStyles/typography.css.js]
[/Users/userX/www/my-project-ui/app/sharedComponents/TitleGeneric/sharedStyles/typography.css.json]
# ./app/sharedComponents/TitleGeneric/style.css (./node_modules/css-loader/dist/cjs.js??ref--6-1!./app/sharedComponents/TitleGeneric/style.css) 5:10-107 12:44-141
# ./app/sharedComponents/TitleGeneric/style.css
# ./app/sharedComponents/TitleGeneric/TitleGeneric.js
# ./app/pages/Knowledge/Bricks/Bricks.js
# ./app/pages/Knowledge/Bricks/BricksContainer.js
# ./app/loaders/pages.js
# ./app/router/routes.js
# ./app/index.js
# multi core-js/stable ./app
Before posting I've done a lot of testing, trying and seeing, modified a lot of code and could not figure out the issue; I've also done quite a lot of research online. Finally checked if there are any posts about this in StackOverflow, which I believe there is not at the moment.
Here's the package.json file:
{
"name": "Foobar",
"version": "1.0.0",
"main": "index.js",
"scripts": {
...
},
"repository": {
"type": "git",
"url": ""
},
"keywords": [],
"license": "ISC",
"engines": {
"node": ">=8.12.0"
},
"nyc": {
"include": [
"app/**/*.js"
],
"require": [
"#babel/register"
],
"all": "true",
"cache": "true",
"reporter": [
"text",
"html"
],
"sourceMap": "false",
"instrument": "false"
},
"dependencies": {
"#babel/core": "^7.5.0",
"#babel/plugin-proposal-class-properties": "^7.5.0",
"#babel/preset-env": "^7.5.3",
"#babel/preset-react": "^7.0.0",
"#babel/register": "^7.4.4",
"#moola/moola-component-library": "^0.3.9",
"#moola/moola-nuka-carousel": "^2.0.4-2",
"axios": "^0.15.3",
"babel-eslint": "^10.0.2",
"babel-loader": "^8.0.6",
"babel-plugin-lodash": "^3.3.4",
"bootstrap": "^3.3.7",
"highcharts": "^4.2.6",
"highcharts-more": "^0.1.2",
"intl": "^1.2.5",
"js-cookie": "^2.1.3",
"jwt-decode": "^2.1.0",
"mime-types": "^2.1.12",
"npm": "^5.8.0",
"numeral": "^1.5.3",
"prop-types": "^15.7.2",
"react": "^16.8.6",
"react-addons-create-fragment": "^15.6.0",
"react-bootstrap": "^0.30.8",
"react-dom": "^16.8.6",
"react-highcharts": "^16.0.2",
"react-highstock": "^1.0.2",
"react-intl": "^2.4.0",
"react-intl-redux": "^2.1.1",
"react-markdown-renderer": "^1.4.0",
"react-modal": "3.8.2",
"react-paginate": "^5.2.2",
"react-redux": "^5.1.1",
"react-router-redux": "^4.0.7",
"react-transition-group": "^2.1.0",
"redux": "^4.0.1",
"redux-debounced": "^0.5.0",
"redux-form": "^7.4.2",
"redux-segment": "^1.6.1",
"redux-thunk": "^2.1.0"
},
"devDependencies": {
"#babel/plugin-proposal-export-default-from": "^7.5.2",
"acorn": "^6.2.0",
"add-asset-html-webpack-plugin": "^3.1.3",
"autoprefixer": "^9.6.1",
"babel-plugin-module-resolver": "^3.2.0",
"chai": "^3.5.0",
"chalk": "^1.1.3",
"core-js": "^3.1.4",
"create-react-class": "^15.6.3",
"css-loader": "^3.0.0",
"cyclist": "^1.0.1",
"enzyme": "^2.9.1",
"es6-promise": "^4.1.0",
"eslint": "^6.0.1",
"eslint-config-standard": "^13.0.0-1 ",
"eslint-plugin-import": "^2.18.0",
"eslint-plugin-node": "^9.1.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-react": "^7.14.2",
"eslint-plugin-standard": "^4.0.0",
"express": "^4.16.4",
"extract-loader": "^3.1.0",
"file-loader": "^4.0.0",
"git-revision-webpack-plugin": "^2.4.0",
"html-webpack-plugin": "^3.2.0",
"html2plaintext": "^2.0.1",
"husky": "^0.11.9",
"jsdom": "^9.4.1",
"json-server": "^0.14.0",
"jspolyfill-array.prototype.find": "^0.1.3",
"jspolyfill-array.prototype.findIndex": "^0.1.0",
"leasot": "^4.7.1",
"lodash-webpack-plugin": "^0.11.5",
"mini-css-extract-plugin": "^0.7.0",
"mocha": "^2.5.3",
"mocha-jenkins-reporter": "^0.2.3",
"mock-css-modules": "^1.0.0",
"moment": "^2.22.2",
"postcss-loader": "^3.0.0",
"postcss-modules-values": "^1.3.0",
"randexp": "^0.5.3",
"react-test-renderer": "^16.8.6",
"sinon": "^1.17.4",
"string-replace-webpack-plugin": "^0.1.3",
"style-loader": "^0.23.1",
"url-loader": "^2.0.1",
"webpack": "^4.35.3",
"webpack-bundle-analyzer": "^1.4.1",
"webpack-cli": "^3.3.5",
"webpack-dev-middleware": "^2.0.6",
"webpack-dev-server": "^2.9.1",
"webpack-hot-middleware": "^2.22.1",
"webpack-merge": "^4.1.0",
"webpack-s3-plugin": "0.9.0"
},
"optionalDependencies": {
"fsevents": "*"
}
}
The webpack base configuration file:
const webpack = require('webpack')
const path = require('path')
const chalk = require('chalk')
const loaderRules = require('./loaders')
const setup = require('./setup')
const PATHS = setup.PATHS
const VALUES = setup.VALUES
const HtmlWebpackPlugin = require('html-webpack-plugin')
const AddAssetHtmlPlugin = require('add-asset-html-webpack-plugin')
const IgnorePlugin = require('webpack/lib/IgnorePlugin')
const LodashReplacePlugin = require('lodash-webpack-plugin')
const isDev = process.env.npm_lifecycle_event !== 'vendor:production'
// Base configuration
const { analyticsKey, applicationPath, htmlLinkPath } = VALUES
let vendorManifest
try {
vendorManifest = require(path.join(PATHS.build, 'vendor.json'))
} catch (e) {
if (e.code !== 'MODULE_NOT_FOUND') {
throw e
}
/* eslint-disable no-console */
console.log(chalk.red('*** Moo.la script error ***'))
console.log(chalk.red('Vendor bundle/manifest not found.\nPlease run ') +
chalk.white('`npm run vendor`') +
chalk.red(' first to generate it, then try again.'))
/* eslint-enable no-console */
process.exit(1)
}
let plugins = [
new webpack.DllReferencePlugin({
context: process.cwd(),
manifest: vendorManifest,
}),
new HtmlWebpackPlugin({
analyticsKey,
template: path.join(PATHS.app, 'shell', 'index.html'),
filename: 'index.html',
inject: 'body',
applicationPath,
htmlLinkPath,
}),
new AddAssetHtmlPlugin({
filepath: path.join(PATHS.build, 'vendor.dll.js'),
includeSourcemap: false,
}),
new IgnorePlugin(/^\.\/locale$/, /moment$/),
new LodashReplacePlugin(),
new webpack.DefinePlugin({
CDN_URL: JSON.stringify(VALUES.baseCdnUrl),
}),
]
const baseConfig = {
entry: {
index: ['core-js/stable', PATHS.app],
},
plugins,
resolve: {
modules: [
PATHS.app,
'node_modules',
],
alias: {
videos: path.resolve(__dirname, '../app/videos/'),
sharedStyles: path.resolve(__dirname, '../app/sharedStyles/'),
images: path.resolve(__dirname, '../app/images/'),
animated: path.resolve(__dirname, '../app/animated/'),
}
},
module: {
rules: loaderRules,
},
optimization: {
namedModules: true,
splitChunks: {
chunks: "all"
},
runtimeChunk: true,
concatenateModules: true,
},
output: {
path: PATHS.build,
filename: '[name]_bundle.js',
chunkFilename: '[name]_chunk.js',
},
}
module.exports = baseConfig
I've also tried to add a plugin to resolve from Babel, but without much luck:
{
"presets": [
["#babel/preset-env", {
"targets": {
"ie": 11
},
"modules": false
}],
"#babel/preset-react",
],
"plugins": [
"#babel/plugin-proposal-class-properties",
"#babel/plugin-proposal-export-default-from",
["module-resolver", {
"root": ["./app"],
"alias": {
"videos": "./app/videos/",
"sharedStyles": "./app/sharedStyles/",
"images": "./app/images/",
"animated": "./app/animated/"
}
}]
]
}
The application is launched by node server.js where server.js looks like (simplified):
const port = 8080
const path = require('path')
const webpack = require('webpack')
const webpackDevMiddleware = require('webpack-dev-middleware')
const webpackHotMiddleware = require('webpack-hot-middleware')
const webpackConfigLocal = require('../webpack/config.local')
...
app.use(bodyParser.json())
router.use(webpackDevMiddleware(compiler, {
publicPath: '/',
logLevel: 'debug',
stats: {
colors: true,
hash: false,
version: true,
timings: false,
assets: false,
chunks: false,
modules: false,
reasons: false,
children: false,
source: false,
errors: true,
errorDetails: true,
warnings: true,
publicPath: false,
},
}))
router.use(webpackHotMiddleware(compiler))
...
app.listen(port, () => console.log(`Development server listening on port ${port}`))
I'm running out of ideas and might have to revert Webpack, Babel and all related plugins and packages back to the previous version instead.
I wonder if there is someone out there who might spot what's wrong or provide any hints or ideas on how to fix this!
Thank you!
I got back to this issue and noticed that at some point past 0.28.x css-loader requires the prefix ~ for aliases.
Find "To import styles from a node_modules path (include resolve.modules) and for alias, prefix it with a ~" in https://github.com/webpack-contrib/css-loader
Related
Hey I am using react microfrontend in my react project with webpack module federation.
After changing folder structure as per microfrontend structure facing some difficulties to handle common dependencies of modules.
Getting Following Error:
ERROR in resolving fallback for shared module react
Module not found: Error: Can't resolve 'react' in '/Users/admin/Desktop/guru/project/microfrontend/modules/metronic/layout/components/subheader/components'
ERROR in resolving fallback for shared module react
Module not found: Error: Can't resolve 'react-router-dom' in '/Users/admin/Desktop/guru/project/microfrontend/modules/metronic/layout/components/subheader/components'
Here I am sharing my code structure
webpack
package.json
folder structure
Webpack:
const path = require('path');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const ModuleFederationPlugin = require("webpack/lib/container/ModuleFederationPlugin");
require('dotenv').config({ path: '../.env' });
module.exports = {
// the output bundle won't be optimized for production but suitable for development
mode: 'development',
// the app entry point is /src/index.js
entry: path.resolve(__dirname, 'src', 'index.js'),
output: {
// the output of the webpack build will be in /dist directory
path: path.resolve(__dirname, 'dist'),
// the filename of the JS bundle will be bundle.js
filename: 'bundle.js',
publicPath: '/'
},
devServer: {
historyApiFallback: true,
},
resolve: {
extensions: ['', '.js', '.jsx'],
},
module: {
rules: [
{
// for any file with a suffix of js or jsx
test: /\.jsx?$/,
// ignore transpiling JavaScript from node_modules as it should be that state
exclude: /node_modules/,
// use the babel-loader for transpiling JavaScript to a suitable format
loader: 'babel-loader',
options: {
// attach the presets to the loader (most projects use .babelrc file instead)
presets: ["#babel/preset-env", "#babel/preset-react"]
}
},
{
// test: /\.s[ac]ss$/i,
test: /\.(sa|sc|c)ss$/,
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|svg|png)(\?v=\d+\.\d+\.\d+)?$/,
use: [
{
loader: 'file-loader',
options: {
name: '[name].[ext]',
outputPath: 'fonts/'
}
}
]
}
]
},
// add a custom index.html as the template
plugins: [
new ModuleFederationPlugin({
name: "app_container",
remotes: {
banners: "banners#http://localhost:3002/remoteEntry.js",
newDashboard: "newDashboard#http://localhost:3008/remoteEntry.js",
baggageService: "baggageService#http://localhost:3016/remoteEntry.js",
},
// shared: [ "react", "react-dom"]
shared: {
"react-router-dom": { singleton: true, eager: true, requiredVersion: "^5.1.2" },
"#manaflair/redux-batch":{ singleton: true, eager: true, requiredVersion: "1.0.0" },
"#reduxjs/toolkit":{ singleton: true, eager: true, requiredVersion: "1.3.6" },
"react-redux":{ singleton: true, eager: true, requiredVersion: "7.1.3" },
"redux":{ singleton: true, eager: true, requiredVersion: "4.0.5" },
"redux-logger":{ singleton: true, eager: true, requiredVersion: "^3.0.6" },
"redux-persist":{ singleton: true, eager: true, requiredVersion: "6.0.0" },
"redux-saga":{ singleton: true, eager: true, requiredVersion: "1.1.3" },
"react": { singleton: true, eager: true, requiredVersion: "^17.0.2" },
"#fortawesome/fontawesome-free": { singleton: true, eager: true, requiredVersion: "5.13.0" },
"react-dom": { singleton: true, eager: true, requiredVersion: "^17.0.2" },
"lodash": { singleton: true, eager: true, requiredVersion: "4.17.21" },
"lodash.debounce": { singleton: true, eager: true, requiredVersion: "^4.0.8" },
}
}),
new HtmlWebpackPlugin({
template: "./public/index.html"
}),
new webpack.DefinePlugin({
"process.env": JSON.stringify(process.env)
})
]
};
In our project have common utils and components that is being used in different micro frontend modules
how to handle that dependencies.
package.json:
{
"name": "microfrontend",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "webpack-dev-server --open",
"build": "webpack --config webpack.prod.config.js --mode production"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"react": "^17.0.2",
"react-dom": "^17.0.2"
},
"devDependencies": {
"#amcharts/amcharts3-react": "^3.0.0",
"#babel/core": "^7.17.5",
"#babel/preset-env": "^7.16.11",
"#babel/preset-react": "^7.16.7",
"#date-io/date-fns": "^1.3.11",
"#formatjs/intl-pluralrules": "1.3.5",
"#fortawesome/fontawesome-free": "^5.13.0",
"#manaflair/redux-batch": "1.0.0",
"#material-ui/core": "^4.10.2",
"#material-ui/icons": "4.9.1",
"#material-ui/pickers": "^3.3.10",
"#material-ui/styles": "4.9.14",
"#reduxjs/toolkit": "1.3.6",
"#tanem/svg-injector": "8.0.50",
"#wojtekmaj/react-daterange-picker": "^3.3.0",
"apexcharts": "3.24.0",
"axios": "0.21.2",
"axios-mock-adapter": "1.18.1",
"babel-loader": "^8.2.3",
"bootstrap": "4.5.0",
"bootstrap-daterangepicker": "^3.1.0",
"clipboard-copy": "3.1.0",
"clsx": "1.1.0",
"cp-cli": "2.0.0",
"css-mediaquery": "0.1.2",
"date-fns": "2.8.1",
"downshift": "3.4.2",
"fg-loadcss": "2.1.0",
"file-loader": "^6.2.0",
"formik": "2.1.4",
"highcharts": "^9.0.0",
"highcharts-react-official": "^3.0.0",
"html-react-parser": "^0.13.0",
"html-webpack-plugin": "^5.5.0",
"html2canvas": "^1.3.2",
"http-service": "file:../modules/http-service",
"i": "^0.3.7",
"json2mq": "0.2.0",
"jss-rtl": "^0.3.0",
"lodash": "4.17.21",
"lodash.debounce": "^4.0.8",
"material-picker-4.0": "npm:#material-ui/pickers#^4.0.0-alpha.12",
"material-ui-popup-state": "1.4.1",
"metronic": "file:../modules/metronic",
"npm": "^6.14.6",
"object-path": "0.11.8",
"perfect-scrollbar": "1.5.0",
"prop-types": "15.7.2",
"quill-emoji": "^0.1.7",
"react-beautiful-dnd": "^13.1.0",
"react-bootstrap": "1.0.1",
"react-bootstrap-daterangepicker": "^7.0.0",
"react-bootstrap-table-next": "4.0.2",
"react-bootstrap-table2-paginator": "2.1.2",
"react-copy-to-clipboard": "^5.0.2",
"react-data-table-component": "^6.9.3",
"react-datepicker": "2.16.0",
"react-draggable": "4.4.2",
"react-highcharts": "^16.1.0",
"react-hooks-helper": "^1.6.0",
"react-html-parser": "^2.0.2",
"react-image-crop": "^8.6.12",
"react-inlinesvg": "1.2.0",
"react-intl": "3.6.2",
"react-is": "16.13.1",
"react-pdf": "^5.7.0",
"react-perfect-scrollbar": "1.5.8",
"react-portal": "4.2.0",
"react-qr-reader": "^2.2.1",
"react-quill": "^1.3.5",
"react-redux": "7.1.3",
"react-router-dom": "5.1.2",
"react-router-last-location": "^2.0.1",
"react-rte": "^0.16.1",
"react-scripts": "3.2.0",
"react-select": "3.1.0",
"react-star-ratings": "^2.3.0",
"react-swipeable-views": "0.13.9",
"react-syntax-highlighter": "12.2.1",
"react-table-hoc-fixed-columns": "^2.3.4",
"react-toastify": "^6.0.6",
"react-window": "1.8.5",
"reactstrap": "^8.5.1",
"redux": "4.0.5",
"redux-logger": "^3.0.6",
"redux-persist": "6.0.0",
"redux-saga": "1.1.3",
"sass": "^1.49.9",
"sass-loader": "^12.6.0",
"socicon": "3.0.5",
"styled-components": "^5.1.1",
"sweetalert2": "^10.12.6",
"sweetalert2-react-content": "^3.2.2",
"common-gui-components": "file:../modules/common-gui-components",
"common-store": "file:../modules/common-store",
"common-utils": "file:../modules/common-utils",
"uuid": "^8.3.2",
"webpack": "^5.70.0",
"webpack-cli": "^4.9.2",
"webpack-dev-server": "^4.7.4",
"yup": "0.29.0"
}
}
My folder structure:
I got this error while setup my react app using the webpack and babel. I try to change the version of babel but still getting the same error. I'm not getting where's the problem.
ERROR in ./src/index.jsx
Module build failed (from ./node_modules/babel-loader/lib/index.js):
Error: Plugin/Preset files are not allowed to export objects, only functions. In /home/arslan/Downloads/code/node_modules/babel-preset-es2015/lib/index.js
at createDescriptor (/home/arslan/Downloads/code/node_modules/#babel/core/lib/config/config-descriptors.js:178:11)
at items.map (/home/arslan/Downloads/code/node_modules/#babel/core/lib/config/config-descriptors.js:109:50)
at Array.map (<anonymous>)
at createDescriptors (/home/arslan/Downloads/code/node_modules/#babel/core/lib/config/config-descriptors.js:109:29)
at createPresetDescriptors (/home/arslan/Downloads/code/node_modules/#babel/core/lib/config/config-descriptors.js:101:10)
at presets (/home/arslan/Downloads/code/node_modules/#babel/core/lib/config/config-descriptors.js:47:19)
at mergeChainOpts (/home/arslan/Downloads/code/node_modules/#babel/core/lib/config/config-chain.js:320:26)
at /home/arslan/Downloads/code/node_modules/#babel/core/lib/config/config-chain.js:283:7
at buildRootChain (/home/arslan/Downloads/code/node_modules/#babel/core/lib/config/config-chain.js:120:22)
at loadPrivatePartialConfig
Here's my Index.jsx File which is the root file.
import React from 'react';
import ReactDOM from 'react-dom';
import { Provider } from 'react-redux'
import store from './store'
import Routes from './routes'
import './assets/scss/style.css';
import { authCheck } from './modules/auth/store/actions'
store.dispatch(authCheck())
ReactDOM.render(
<Provider store={store}>
<Routes />
</Provider>
,document.getElementById('app'));
Here's my Package.json File which includes all the dependencies.
{
"name": "bebes",
"version": "1.0.0",
"description": "",
"main": "index.jsx",
"scripts": {
"start": "webpack-dev-server --open --mode development",
"build": "webpack --mode production"
},
"author": "",
"license": "ISC",
"dependencies": {
"express": "^4.17.0",
"path": "^0.12.7",
"react": "^16.8.6",
"react-dom": "^16.8.6",
"require": "^2.4.20",
"webpack-encoding-plugin": "^0.3.1"
},
"devDependencies": {
"#babel/core": "^7.6.4",
"#babel/plugin-proposal-class-properties": "^7.2.3",
"#babel/plugin-syntax-dynamic-import": "^7.2.0",
"#babel/preset-env": "^7.6.3",
"#babel/preset-es2015": "^7.0.0-beta.53",
"#babel/preset-react": "^7.0.0",
"#material-ui/core": "^3.9.3",
"#material-ui/icons": "^3.0.2",
"axios": "^0.18.0",
"babel-core": "^6.26.3",
"babel-loader": "^8.0.6",
"babel-plugin-transform-decorators-legacy": "^1.3.5",
"babel-preset-es2015": "^6.24.1",
"bootstrap": "4.1.3",
"chart.js": "2.7.2",
"chroma-js": "^1.4.1",
"firebase": "^5.7.2",
"history": "4.7.2",
"html-loader": "^0.5.5",
"html-webpack-plugin": "^3.2.0",
"immutability-helper": "2.7.1",
"joi": "^13.7.0",
"joi-validation-strategy": "^0.3.3",
"lodash": "^4.17.11",
"moment": "^2.23.0",
"namor": "^1.1.1",
"node-sass": "^4.10.0",
"node-sass-chokidar": "^1.3.4",
"npm-run-all": "4.1.3",
"prop-types": "^15.6.2",
"react": "^16.7.0",
"react-big-calendar": "0.19.2",
"react-bootstrap-sweetalert": "^4.4.1",
"react-bootstrap-switch": "^15.5.3",
"react-bootstrap-table": "^4.3.1",
"react-bootstrap-wizard": "0.0.5",
"react-c3-component": "^1.4.0",
"react-c3js": "^0.1.20",
"react-chartjs-2": "^2.7.4",
"react-datetime": "^2.16.3",
"react-dom": "^16.7.0",
"react-iframe": "1.3.0",
"react-jvectormap": "0.0.3",
"react-loadable": "^5.5.0",
"react-perfect-scrollbar": "1.2.0",
"react-redux": "^6.0.1",
"react-router-dom": "4.2.2",
"react-scripts": "2.1.3",
"react-select": "^2.2.0",
"react-sparklines": "^1.7.0",
"react-stepzilla": "^4.8.0",
"react-table": "^6.8.6",
"react-tagsinput": "^3.19.0",
"react-validation": "^3.0.7",
"react-validation-mixin": "^5.4.0",
"reactstrap": "6.4.0",
"redux": "^4.0.1",
"redux-thunk": "^2.3.0",
"ree-validate": "^3.0.2",
"sweetalert": "^2.1.2",
"validator": "^10.10.0",
"webpack": "^4.41.2",
"webpack-cli": "^3.3.2",
"webpack-dev-server": "^3.4.1"
}
}
The configuration that i use for the webpack is given below
const HtmlWebPackPlugin = require("html-webpack-plugin");
const EncodingPlugin = require('webpack-encoding-plugin');
const path = require('path');
const webpack = require('webpack');
const { join, resolve } = require('path');
module.exports = {
mode: 'development',
entry: './src/index.jsx',
output: {
path:path.resolve(__dirname, 'dist'),
filename:'bundle.js'
},
devServer: {
contentBase: path.resolve(__dirname, 'dist'),
compress: true,
historyApiFallback: true,
watchOptions: { aggregateTimeout: 300, poll: 1000 },
inline: true,
host: process.env.HOST, // set in Dockerfile for client container
port: process.env.PORT, // set in Dockerfile for client container
disableHostCheck: true, // when manipulating /etc/hosts
headers: {
'Access-Control-Allow-Origin': '*',
'Content-Type': 'application/javascript; charset=windows-1251'
}
},
module: {
rules: [
{
test: /\.(js|jsx|css)$/,
exclude: /(node_modules|bower_components)/,
use: {
loader: "babel-loader",
options: {
babelrc: true,
presets: ['#babel/preset-env']
}
}
},
{
test: /\.html$/,
use: [
{
loader: "html-loader"
}
]
}
]
},
plugins: [
new HtmlWebPackPlugin({
template: './public/index.html',
filename: 'index.html'
})
]
};
The configuration file for the .babelrc is here.
{
"presets": [
"#babel/preset-env", "#babel/preset-react","es2015", "react", "stage-1"
],
"plugins": [
"#babel/plugin-proposal-class-properties",
"#babel/plugin-syntax-dynamic-import"
]
}
The error you are getting is because you are trying to use a Babel 6 preset on Babel 7.
"#babel/preset-env", "#babel/preset-react","es2015", "react", "stage-1"
is not quite right.
"es2015" was replaced by "#babel/preset-env"
"react" was replaced by "#babel/preset-react"
"stage-1" does not exist for Babel 7 and you should use the individual plugins that you actually want to enable.
Change your config to
"presets": [
"#babel/preset-env", "#babel/preset-react"
],
and then add more plugins if there are other things that give you errors when you compile.
I think you should try the following
npm uninstall --save babel-loader
npm uninstall --save #babel/core
npm install --save-dev babel-loader#^7
That worked for me.
Also have a look at your dependencies, you are having some duplicates that could lead you to errors at some moment.
I wanna to use GoGO template in React, but i have this problem.
Uncaught Error: Module parse failed: Unexpected token (29:12)
You may need an appropriate loader to handle this file type.
|
| var render = function render() {
> var css = import('./assets/css/sass/themes/gogo.' + color + '.scss').then(function (x) {
| var MainApp = require('./App').default;
|
at eval (index.js:1)
at Object../src/index.js (main.f444d441.js:6169)
at __webpack_require__ (main.f444d441.js:724)
at fn (main.f444d441.js:101)
at eval (webpack:///multi_(:3005/webpack)-dev-server/client?:5:18)
at Object.0 (main.f444d441.js:6180)
at __webpack_require__ (main.f444d441.js:724)
at main.f444d441.js:791
at main.f444d441.js:794
I tried different approuch but I can't solved this problem.
This is a link to source code page.
https://themeforest.net/item/gogo-react-bootstrap-4-admin-dashboard/22544383/comments?page=5
webpack.config.js
'use strict';
/**
* Webpack Config
*/
const path = require('path');
const fs = require('fs');
const FriendlyErrorsWebpackPlugin = require('friendly-errors-webpack-plugin');
// const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
// Webpack uses `publicPath` to determine where the app is being served from.
// In development, we always serve from the root. This makes config easier.
const publicPath = '/';
// Make sure any symlinks in the project folder are resolved:
const appDirectory = fs.realpathSync(process.cwd());
const resolveApp = relativePath => path.resolve(appDirectory, relativePath);
// plugins
const HtmlWebPackPlugin = require("html-webpack-plugin");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const CleanWebpackPlugin = require('clean-webpack-plugin');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const OptimizeCSSAssetsPlugin = require("optimize-css-assets-webpack-plugin");
const CopyWebpackPlugin = require('copy-webpack-plugin');
// the path(s) that should be cleaned
let pathsToClean = [
'dist',
'build'
]
// the clean options to use
let cleanOptions = {
root: __dirname,
verbose: false, // Write logs to console.
dry: false
}
module.exports = {
entry: ["babel-polyfill", "react-hot-loader/patch", "./src/index.js"],
output: {
// The build folder.
path: resolveApp('dist'),
// 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: 'assets/js/[name].[hash:8].js',
chunkFilename: 'assets/js/[name].[hash:8].chunk.js',
// We inferred the "public path" (such as / or /my-project) from homepage.
publicPath: publicPath,
hotUpdateChunkFilename: 'hot/hot-update.js',
hotUpdateMainFilename: 'hot/hot-update.json'
},
devServer: {
contentBase: './src/index.js',
compress: true,
port: 3005, // port number
historyApiFallback: true,
quiet: true
},
// resolve alias (Absolute paths)
resolve: {
alias: {
Components: path.resolve(__dirname, 'src/components/'),
Containers: path.resolve(__dirname, 'src/containers/'),
Assets: path.resolve(__dirname, 'src/assets/'),
Util: path.resolve(__dirname, 'src/util/'),
Routes: path.resolve(__dirname, 'src/routes/'),
Constants: path.resolve(__dirname, 'src/constants/'),
Redux: path.resolve(__dirname, 'src/redux/'),
Data: path.resolve(__dirname, 'src/data/')
}
},
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: {
loader: "babel-loader"
}
},
{
test: /\.html$/,
use: [
{
loader: "html-loader",
options: { minimize: true }
}
]
},
{
test: /\.css$/,
use: [MiniCssExtractPlugin.loader, "css-loader"]
},
// Scss compiler
{
test: /\.scss$/,
use: [
MiniCssExtractPlugin.loader,
"css-loader",
"sass-loader",
"style-loader",
// "postcss-loader"
]
},
// {
// test: /\.scss$/,
// use: ExtractTextPlugin.extract({
// use: [{
// loader: "css-loader"
// }, {
// loader: "sass-loader"
// }],
// fallback: "style-loader"
// })
// }
// {
// test: /\.scss$/,
// use: [
// 'style-loader',
// 'css-loader',
// 'postcss-loader',
// 'sass-loader',
// 'postcss-loader'
// {
// loader: 'sass-resources-loader',
// options: {
// // Provide path to the file with resources
// resources: 'src/assets/css/sass/themes/gogo.light.purple.scss',
//
// // Or array of paths
// // resources: ['./path/to/vars.scss', './path/to/mixins.scss']
// },
// },
// ],
// },
]
},
optimization: {
minimizer: [
new UglifyJsPlugin({
cache: true,
parallel: true,
uglifyOptions: {
compress: false,
ecma: 6,
mangle: true
},
sourceMap: true
}),
new OptimizeCSSAssetsPlugin({})
]
},
performance: {
hints: process.env.NODE_ENV === 'production' ? "warning" : false
},
plugins: [
new CopyWebpackPlugin([
{from:'src/assets/img',to:'assets/img'},{from:'src/assets/fonts',to:'assets/fonts'}
]),
new FriendlyErrorsWebpackPlugin(),
new CleanWebpackPlugin(pathsToClean, cleanOptions),
new HtmlWebPackPlugin({
template: "./public/index.html",
filename: "./index.html",
favicon: './public/favicon.ico'
}),
new MiniCssExtractPlugin({
filename: "assets/css/[name].[hash:8].css"
})
]
};
package.json
{
"name": "gogo-react",
"version": "2.0.2",
"description": "Gogo - React Bootstrap 4 Admin Dashboard Template",
"scripts": {
"start": "webpack-dev-server --mode development --hot --progress --open",
"build": "webpack --mode production"
},
"keywords": [
"reactjs"
],
"author": "Colored Strategies",
"license": "ISC",
"devDependencies": {
"babel-core": "^6.26.0",
"babel-eslint": "^7.2.3",
"babel-loader": "^7.1.4",
"babel-polyfill": "^6.26.0",
"babel-preset-env": "^1.6.1",
"babel-preset-react": "^6.24.1",
"babel-preset-stage-2": "^6.24.1",
"clean-webpack-plugin": "^0.1.19",
"copy-webpack-plugin": "^4.5.2",
"css-loader": "^2.0.0",
"eslint": "^4.19.1",
"eslint-config-react-app": "^2.1.0",
"eslint-plugin-flowtype": "^2.47.1",
"eslint-plugin-import": "^2.12.0",
"eslint-plugin-jsx-a11y": "^5.1.1",
"eslint-plugin-react": "^7.8.2",
"extract-text-webpack-plugin": "^3.0.2",
"file-loader": "^1.1.11",
"friendly-errors-webpack-plugin": "^1.7.0",
"html-loader": "^0.5.5",
"html-webpack-plugin": "^3.2.0",
"mini-css-extract-plugin": "^0.5.0",
"node-sass": "^4.8.3",
"optimize-css-assets-webpack-plugin": "^5.0.1",
"react": "^16.3.1",
"react-dom": "^16.3.1",
"react-hot-loader": "^4.1.3",
"sass-loader": "^7.1.0",
"uglifyjs-webpack-plugin": "^1.2.5",
"url-loader": "^1.0.1",
"webpack": "^4.27.1",
"webpack-bundle-analyzer": "^2.11.1",
"webpack-cli": "^3.1.2",
"webpack-dev-server": "^3.1.10"
},
"dependencies": {
"#date-io/moment": "0.0.2",
"availity-reactstrap-validation": "^2.0.4",
"axios": "^0.18.0",
"chart.js": "^2.7.2",
"chartjs-plugin-datalabels": "^0.3.0",
"classnames": "2.2.6",
"draft-js": "^0.10.5",
"fine-uploader": "^5.16.2",
"firebase": "^5.3.0",
"formik": "^1.5.4",
"install": "^0.12.2",
"jalali-moment": "^3.3.1",
"jwt-decode": "^2.2.0",
"material-ui": "^0.20.2",
"material-ui-persian-date-picker-utils": "^0.1.2",
"material-ui-pickers": "^2.0.4",
"moment": "^2.22.2",
"npm": "^6.5.0",
"postcss-loader": "^3.0.0",
"rc-slider": "^8.6.1",
"rc-switch": "^1.6.0",
"react": "^16.4.1",
"react-autosuggest": "^9.3.4",
"react-big-calendar": "^0.19.2",
"react-block-ui": "^1.1.3",
"react-chartjs-2": "^2.7.4",
"react-circular-progressbar": "^1.0.0",
"react-contextmenu": "^2.9.4",
"react-datepicker": "^1.5.0",
"react-dom": "^16.4.1",
"react-fine-uploader": "^1.1.0",
"react-headroom": "^2.2.4",
"react-intl": "2.4.0",
"react-lines-ellipsis": "^0.13.2",
"react-loadable": "5.4.0",
"react-mousetrap": "^0.2.0",
"react-perfect-scrollbar": "^1.1.1",
"react-quill": "^1.3.1",
"react-rater": "^5.0.3",
"react-redux": "5.0.7",
"react-router-dom": "^4.2.2",
"react-scroll-to-component": "^1.0.2",
"react-select": "^2.0.0-beta.7",
"react-sortablejs": "^1.3.6",
"react-table": "^6.8.6",
"react-tagsinput": "^3.19.0",
"react-transition-group": "^1.2.0",
"reactstrap": "^6.5.0",
"redux": "4.0.0",
"redux-saga": "^0.16.0",
"sass-resources-loader": "^2.0.0",
"sortablejs": "^1.6.1",
"style-loader": "^0.23.1",
"sweetalert2": "^8.8.7",
"video.js": "^7.3.0",
"yup": "^0.27.0"
}
}
Please help me, thanks in advance.
If you are using latest version of react then no need to set loader in webpack.config.js file.
You can directly do this,
npm install sass-loader
And you can start using your scss files in the project.
It is about files which start with a dot being hidden by his os and failing to copy them.
In project directory there should be a ”.babelrc” and ”.eslintrc” files and the problem occurs when ”.babelrc” file is missing. Maybe you should also check it when you have time.
I'm trying to use ASP.NET Core 2 with Webpack 4 and React and I would love hot reloading. Problem is; when I try to make a change to one of the files it comes back with this error in Chrome:
:8100/dist/__webpack_hmr Failed to load resource: net::ERR_INCOMPLETE_CHUNKED_ENCODING.
My package.json:
{
"name": "ui",
"private": true,
"version": "0.1.0",
"license": "UNLICENSED",
"description": "Application",
"devDependencies": {
"#types/history": "4.6.0",
"#types/jquery": "3.3.1",
"#types/jsonwebtoken": "^7.2.6",
"#types/lodash": "4.14.105",
"#types/moment": "2.13.0",
"#types/query-string": "^5.1.0",
"#types/react": "^16.0.40",
"#types/react-dates": "16.0.5",
"#types/react-dom": "^15.5.1",
"#types/react-redux": "^4.4.45",
"#types/react-router": "4.0.12",
"#types/react-router-dom": "4.0.5",
"#types/react-router-redux": "5.0.3",
"#types/webpack": "2.2.15",
"#types/webpack-env": "1.13.0",
"airbnb-prop-types": "2.8.1",
"aspnet-prerendering": "3.0.1",
"aspnet-webpack": "2.0.1",
"aspnet-webpack-react": "3.0.0",
"awesome-typescript-loader": "3.2.1",
"bootstrap": "4.0.0",
"css-loader": "^0.28.11",
"domain-task": "3.0.3",
"event-source-polyfill": "0.0.9",
"extract-text-webpack-plugin": "^3.0.2",
"file-loader": "1.1.11",
"glob": "^7.1.2",
"history": "4.6.3",
"install": "0.10.4",
"jquery": "3.2.1",
"jquery-mask-plugin": "1.14.15",
"jsonwebtoken": "^8.2.0",
"lodash": "4.17.5",
"moment": "2.21.0",
"muicss": "0.9.38",
"myriad-font": "0.0.2",
"node-noop": "1.0.0",
"node-sass": "^4.7.2",
"numbro": "2.0.5",
"path": "0.12.7",
"popper.js": "1.14.1",
"postcss-cssnext": "^3.1.0",
"postcss-loader": "2.1.1",
"prop-types": "15.6.1",
"query-string": "^6.0.0",
"react": "^16.2.0",
"react-addons-css-transition-group": "15.6.2",
"react-cookie": "^2.1.4",
"react-dom": "^16.2.0",
"react-moment": "0.7.0",
"react-moment-proptypes": "1.5.0",
"react-redux": "^5.0.7",
"react-router-dom": "4.1.1",
"react-router-redux": "^5.0.0-alpha.9",
"redux": "3.7.1",
"redux-thunk": "2.2.0",
"rxjs": "5.5.7",
"sass-loader": "^6.0.7",
"sfcookies": "^1.0.2",
"source-map-loader": "0.2.3",
"style-loader": "^0.18.2",
"tslint": "^5.9.1",
"tslint-react": "^3.5.1",
"typescript": "^2.7.2",
"url-loader": "1.0.1",
"webpack": "^4.2.0",
"webpack-cli": "^2.0.13",
"webpack-hot-middleware": "^2.21.2",
"webpack-merge": "4.1.2"
},
"scripts": {
"compile-vendor": "webpack --config webpack.config.vendor.js",
"compile-client": "webpack --config webpack.config.js"
},
"dependencies": {
"#types/react-hot-loader": "^3.0.6",
"react-hot-loader": "^3.1.1"
}
}
And my webpack.config.js:
"use strict";
const path = require('path');
const webpack = require('webpack');
const CheckerPlugin = require('awesome-typescript-loader').CheckerPlugin;
const merge = require('webpack-merge');
const ExtractTextPlugin = require("extract-text-webpack-plugin");
const glob = require('glob');
module.exports = (env) => {
const isDevBuild = !(env && env.prod);
// Configuration in common to both client-side and server-side bundles
const sharedConfig = () => ({
mode: !(env && env.prod) ? 'development' : 'production',
stats: { modules: false },
resolve: { extensions: ['.js', '.jsx', '.ts', '.tsx'] },
output: {
filename: '[name].js',
publicPath: 'dist/' // Webpack dev middleware, if enabled, handles requests for this URL prefix
},
module: {
rules: [
{
test: /\.tsx?$/,
include: /ClientApp/,
use: 'awesome-typescript-loader?silent=false'
},
{
test: /\.(png|jpg|jpeg|gif|svg)$/,
loader: "file-loader",
options: {
limit: 50000,
name: "./img/[name].[ext]"
}
},
{
// Match woff2 in addition to patterns like .woff?v=1.1.1.
test: /\.(woff|woff2|ttf)(\?v=\d+\.\d+\.\d+)?$/,
loader: "file-loader",
options: {
limit: 50000,
name: "./fonts/[name].[ext]"
}
}
]
},
performance: {
hints: false
},
devtool: 'cheap-module-source-map',
plugins: [new CheckerPlugin()]
});
// Configuration for client-side bundle suitable for running in browsers
const clientBundleOutputDir = './wwwroot/dist';
const clientBundleConfig = merge(sharedConfig(), {
entry: {
"main-client": ['./ClientApp/boot-client.tsx'].concat(glob.sync('./ClientApp/img/**/*.svg'))
},
module: {
rules: [
{
test: /\.(scss|css)$/,
loader: ExtractTextPlugin.extract({
fallback: "style-loader",
use: [
{
loader: "css-loader",
options: {
importLoaders: 1
}
},
"postcss-loader"
]
}),
exclude: /node_modules/
}
]
},
output: { path: path.join(__dirname, clientBundleOutputDir) },
plugins: [
new ExtractTextPlugin("site.css"),
new webpack.DllReferencePlugin({
context: __dirname,
manifest: require('./wwwroot/dist/vendor-manifest.json')
}),
new webpack.NamedModulesPlugin()
]
});
return [clientBundleConfig];
};
I'm trying to setup a webpack 2, babel, and React configuration for achieving:
Native ES6/ES7 features
Tree shaking builds
Hot reloading
I had a demo repo but it has distinct stuff mixed, like even JSHint and ESLint at the same time.
I'd like to get my setup up and running and get suggestions for best practices
So, as first option I tried to use babel-preset-env. Then after some dependencies being installed. I ran into this issue:
ERROR in ./src/main.jsx
Module build failed: SyntaxError: 'import' and 'export' may only appear at the top level (3:0)
However, the first line in my code is import 'babel-polyfill'; then just import's.
This is how my Babel config file looks like:
{
"presets": [
[
"env",
{
"modules": false,
"targets": {
"browsers": ["last 2 versions"]
}
}
],
"react"
],
"plugins": [
"babel-plugin-transform-class-properties",
"transform-react-require"
]
}
This is what my development webpack config file looks like:
const webpack = require('webpack');
const autoprefixer = require('autoprefixer');
const path = require('path');
const buildPath = path.resolve(__dirname, 'build');
const nodeModulesPath = path.resolve(__dirname, 'node_modules');
const TransferWebpackPlugin = require('transfer-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const config = {
//Entry points to the project
entry: [
'babel-polyfill',
'webpack/hot/dev-server',
'webpack/hot/only-dev-server',
path.join(__dirname, '../src/main.jsx')
],
//Config options on how to interpret requires imports
resolve: {
extensions: [".js", ".jsx"]
},
//Server Configuration options
devServer:{
contentBase: 'build', //Relative directory for base of server
devtool: 'eval',
hot: true, //Live-reload
inline: true,
port: 3000, //Port Number
host: 'localhost', //Change to '0.0.0.0' for external facing server
proxy: {
'^\/api': {
target: 'http://127.0.0.1:9090'
}
},
historyApiFallback: true
},
devtool: 'eval',
output: {
path: buildPath, //Path of output file
filename: 'app.js'
},
plugins: [
new webpack.DefinePlugin({
API_BASE: '""',
PRODUCTION: false,
'process.env.NODE_ENV': '"development"'
}),
//Enables Hot Modules Replacement
new webpack.HotModuleReplacementPlugin(),
//Allows error warnings but does not stop compiling. Will remove when eslint is added
new webpack.NoEmitOnErrorsPlugin(),
//Moves files
new TransferWebpackPlugin([
{from: 'www'}
], path.resolve(__dirname, "src")),
new ExtractTextPlugin("main.css")
],
module: {
rules: [
{
//React-hot loader and
test: /\.(js|jsx)$/, //All .js and .jsx files
loaders: [ 'babel-loader', 'react-hot-loader'],
//react-hot is like browser sync and babel loads jsx and es6-7
exclude: [nodeModulesPath]
},
{
test: /\.scss$/,
loader: ExtractTextPlugin.extract({
fallback: 'style',
use: 'css'
})
},
{
test: /\.svg$/,
loader: 'svg-sprite?' + JSON.stringify({
name: '[name]_[hash]',
prefixize: true
})
}
]
}
};
module.exports = config;
And this below is package.json
{
"name": "LumaHealth",
"version": "1.0.0",
"description": "LumaHealth",
"main": "start.js",
"scripts": {
"start": "webpack --config ./webpack/webpack.config.development.js",
"build": "webpack --config ./webpack/webpack.config.production.js",
"clean": "rm build/app.js"
},
"repository": {
"type": "git",
"url": "git#github.com:lumahealthhq/web-app.git"
},
"keywords": [],
"author": "Marcelo Oliveira",
"license": "MIT",
"devDependencies": {
"babel-cli": "^6.24.0",
"babel-core": "^6.24.0",
"babel-eslint": "^7.2.1",
"babel-plugin-react-require": "^3.0.0",
"babel-plugin-transform-class-properties": "^6.23.0",
"babel-preset-env": "^1.2.2",
"babel-preset-react": "^6.23.0",
"css-loader": "^0.26.4",
"enzyme": "^2.0.0",
"eslint": "^3.7.1",
"eslint-config-airbnb": "^14.1.0",
"eslint-loader": "^1.7.0",
"eslint-plugin-import": "^2.2.0",
"eslint-plugin-jsx-a11y": "^4.0.0",
"eslint-plugin-react": "^6.4.1",
"extract-text-webpack-plugin": "^2.1.0",
"html-webpack-plugin": "^2.28.0",
"nyc": "^10.1.2",
"postcss-loader": "^1.3.3",
"postcss-nested": "^1.0.0",
"react-addons-test-utils": "^15.4.1",
"sinon": "^1.17.2",
"style-loader": "^0.13.2",
"sw-precache": "^5.0.0",
"transfer-webpack-plugin": "^0.1.4",
"webpack": "^2.3.2",
"webpack-dev-server": "^2.4.2"
},
"dependencies": {
"babel-core": "^6.5.2",
"babel-eslint": "^7.0.0",
"babel-plugin-transform-react-require": "^1.0.1",
"babel-polyfill": "^6.23.0",
"co": "^4.6.0",
"express": "^4.12.3",
"file-loader": "^0.10.1",
"humps": "^2.0.0",
"isomorphic-fetch": "^2.2.1",
"local-storage": "^1.4.2",
"lodash": "^4.16.4",
"material-ui": "^0.17.0",
"moment": "^2.15.2",
"q": "^1.4.1",
"react": "^15.4.1",
"react-dom": "^15.4.1",
"react-redux": "^5.0.3",
"react-router": "^3.0.2",
"react-router-redux": "^4.0.6",
"react-slick": "^0.14.4",
"react-tap-event-plugin": "^2.0.0",
"react-web-notification": "^0.2.3",
"redux": "^3.6.0",
"redux-form": "^6.1.1",
"redux-logger": "^2.7.0",
"redux-socket.io": "^1.3.1",
"redux-thunk": "^2.1.0",
"socket.io-client": "^1.7.2",
"url-loader": "^0.5.7",
"vanilla-masker": "^1.0.9"
}
}
I recently upgraded my boilerplate from webpack 1 to webpack 2, feel free to get any information / concept from the webpack config file there, hope it helps.
https://github.com/iroy2000/react-redux-boilerplate