Webpack devServer set up on localhost opening the wrong local URL - wordpress

I'm working on a WordPress plugin that will use a React App. I'm trying to get devServer to work with live reload. I need it to open http://localhost/shuffledink/builder in the browser. My current setup keeps opening http://localhost:8085 and shows all the files in assets/js when I run npm start. I commented out the port in my webpack config because I kept getting error:
code: 'EADDRINUSE',
errno: -4091,
syscall: 'listen',
address: '127.0.0.1',
port: 80
I'm using XAMPP apache local server on port 80.
I also get this message in terminal:
[webpack-dev-server] Content not from webpack is served from 'C:\xampp\htdocs\shuffledink\wp-content\plugins\shuffled-ink-builder\assets\js' directory
Which is the correct path to my bundle files so I think that part is okay?
Here is my current config:
const path = require("path");
const webpack = require("webpack");
module.exports = {
mode: "development",
entry: {
main: "./src/index.js",
},
output: {
path: path.resolve(__dirname, "/assets/js"),
filename: "[name].bundle.js",
publicPath: "/assets/js/",
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: [
{
loader: "babel-loader",
options: {
presets: ["#babel/preset-env"],
},
},
],
},
{
test: /\.s?css$/,
use: ["style-loader", "css-loader", "sass-loader"],
},
],
},
devServer: {
host: "localhost",
//port: 80,
static: path.join(__dirname, "/assets/js"),
liveReload: true,
open: true,
proxy: {
"/shuffledink/builder/": {
target: "http://localhost",
secure: false,
},
},
},
};
Here is my package.json:
{
"name": "Shuffled Ink",
"version": "1.0",
"private": true,
"description": "Shuffled Ink Card Bulder",
"scripts": {
"start": "webpack-dev-server --mode development",
"build": "webpack --mode production"
},
"devDependencies": {
"#babel/core": "^7.19.6",
"#babel/preset-env": "^7.19.4",
"#babel/preset-react": "^7.18.6",
"babel-loader": "^8.2.5",
"clean-webpack-plugin": "^4.0.0",
"css-loader": "^6.7.1",
"mini-css-extract-plugin": "^2.6.1",
"style-loader": "^3.3.1",
"webpack": "^5.74.0",
"webpack-cli": "^4.10.0",
"webpack-dev-server": "^4.11.1"
},
"dependencies": {
"#eastdesire/jscolor": "^2.5.1",
"#emotion/react": "^11.10.5",
"#emotion/styled": "^11.10.5",
"#mui/icons-material": "^5.11.0",
"#mui/material": "^5.11.1",
"#types/jest": "^29.2.4",
"#types/node": "^18.11.17",
"#types/react": "^18.0.26",
"#types/react-dom": "^18.0.9",
"fabric": "^5.2.4",
"fabric-history": "^1.7.0",
"node-sass": "^7.0.3",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"sass": "^1.55.0",
"sass-loader": "^13.1.0",
"selectable.js": "^0.18.0",
"sortablejs": "^1.15.0",
"typescript": "^4.9.4"
}
}
I'm including my bundled JS file in my WordPress plugin like so:
function builder_scripts() {
if(get_query_var('custom_page')) {
wp_register_script('shuffled_ink_builder_scripts', plugins_url('assets/js/main.bundle.js', __FILE__), array(),null, true);
wp_enqueue_script('shuffled_ink_builder_scripts');
}
}

If the webpack-dev-server is opening the wrong URL, you can specify the correct URL by setting the public option in your webpack.config.js file:
module.exports = {
// ...
devServer: {
public: 'http://localhost:3000', // Specify the correct URL
// ...
}
};
Alternatively, you can start the webpack-dev-server with the --host option to specify the hostname to bind to:
webpack-dev-server --host 0.0.0.0
This should resolve the issue of the webpack-dev-server opening the wrong URL.

Related

Webpack Dev Server stops on error originated in postcss-loader

I'm using webpack-dev-server for development but after upgrading to webpack 5 it just stops when postcss-loader can't parse css file.
I start dev server via npx webpack-dev-server and when I start typing new rule in .css webpack tries to rebuild my app but since I haven't finished typing, file contains incorrect css rule. So build fails due to postcss-loader throwing error CssSyntaxError. However that makes webpack-dev-server stop completely. Previously webpack-dev-server simply ignored failed builds and waited till webpack manages to successfully build my app.
I prepared git repo where this can be reproduced: https://github.com/s-shev/webpack-dev-server-stops
I'm using latest versions of webpack, webpack-cli and webpack-dev-server
I'd appreciate if anyone can say whether I'm doing something wrong or if it's a bug in webpack-dev-derver.
Here's my webpack.config:
const path = require("path");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const devMode = process.env.NODE_ENV !== "production";
module.exports = {
mode: devMode ? "development" : "production",
devtool: devMode ? "eval-cheap-module-source-map" : "source-map",
entry: path.resolve(__dirname, "./src/index"),
devServer: {
host: "0.0.0.0",
port: 9000,
},
module: {
rules: [
{
test: /\.tsx?$/,
exclude: /node_modules/,
use: { loader: "ts-loader" },
},
{
test: /\.css$/,
exclude: /node_modules/,
use: ["style-loader", "css-loader", "postcss-loader"],
},
],
},
resolve: {
extensions: [".ts", ".tsx", ".js"],
modules: ["./node_modules"],
},
plugins: [
new HtmlWebpackPlugin({
template: path.join(__dirname, "public", "index.html"),
}),
],
};
and pacakge.json:
{
"name": "webpack-dev-server-stops",
"version": "1.0.0",
"description": "",
"private": true,
"scripts": {
"start": "webpack-dev-server"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"#types/react": "^18.0.15",
"#types/react-dom": "^18.0.6",
"css-loader": "^6.7.1",
"html-webpack-plugin": "^5.5.0",
"postcss-loader": "^7.0.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"style-loader": "^3.3.1",
"ts-loader": "^9.3.1",
"typescript": "^4.7.4",
"typescript-plugin-css-modules": "^1.3.1",
"webpack": "^5.73.0",
"webpack-cli": "^4.10.0",
"webpack-dev-server": "^4.9.3"
}
}
Turned out to be an issue in postcss. Updating postcss-loader to 7.0.1 fixed the issue.
https://github.com/webpack/webpack-dev-server/issues/4514

NodeJS webpack configuration error for sass and css

I recently updated my NodeJS version to 'v16.13.2' and ever since then my template I built is breaking when trying to bundle the scss and css. Everything else works just fine when building.
I'm aware that node-sass had been deprecated and I should use sass (dart-sass). However, when I run my build I get this error:
Module parse failed: C:\Users\...\src\styles\styles.scss Unexpected token (1:3)
You may need an appropriate loader to handle this file type.
| h1 {
| color: white;
| text-align: center;
# ./src/app.js 25:0-31
# multi (webpack)-dev-server/client?http://localhost:8080 babel-polyfill ./src/app.js
I'm trying to get basic css to work but the loader doesn't seem to recognize the code.
Here is my code
package.json:
"scripts": {
"build:dev": "webpack",
"build:prod": "webpack -p --env production",
"dev-server": "webpack-dev-server",
"test": "cross-env NODE_ENV=test jest --config=jest.config.json",
"start": "node server/server.js",
"heroku-postbuild": "yarn run build:prod"
},
"dependencies": {
"babel-cli": "6.24.1",
"babel-core": "6.25.0",
"babel-loader": "7.1.1",
"babel-plugin-transform-class-properties": "6.24.1",
"babel-plugin-transform-object-rest-spread": "6.23.0",
"babel-polyfill": "6.26.0",
"babel-preset-env": "1.5.2",
"babel-preset-react": "6.24.1",
"css-loader": "^6.5.1",
"express": "4.15.4",
"extract-text-webpack-plugin": "3.0.0",
"firebase": "^8.9.1",
"history": "4.10.1",
"moment": "2.18.1",
"normalize.css": "7.0.0",
"numeral": "2.0.6",
"react": "^16.14.0",
"react-addons-shallow-compare": "15.6.0",
"react-dates": "12.7.0",
"react-dom": "^16.14.0",
"react-modal": "2.2.2",
"react-redux": "5.0.5",
"react-router-dom": "4.1.2",
"redux": "3.7.2",
"redux-mock-store": "1.2.3",
"redux-thunk": "2.2.0",
"sass": "^1.49.7",
"sass-loader": "7.3.1",
"style-loader": "0.18.2",
"uuid": "3.1.0",
"validator": "8.0.0",
"webpack": "3.1.0"
},
"devDependencies": {
"cross-env": "5.0.5",
"dotenv": "^14.2.0",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.6",
"enzyme-to-json": "^3.6.1",
"jest": "20.0.4",
"raf": "^3.4.1",
"react-test-renderer": "^16.14.0",
"webpack-dev-server": "2.5.1"
}
webpack.cnfig.js:
return{
entry: ['babel-polyfill','./src/app.js'],
output: {
path: path.join(__dirname, 'public', 'dist'),
filename: 'bundle.js'
},
module: {
rules: [{
loader: 'babel-loader',
test: /\.js$/,
exclude: /node_modules/
},
{
test: /\.s?css$/,
use: CSSExtract.extract({
use: [
{
loader: 'css-loader',
options:{
sourceMap: true
}
},
{
loader: 'sass-loader',
options:{
sourceMap: true
}
}
]
})
}
]
},
EDIT: So after much research, I have also figured out that 'extract-text-webpack-plugin' is also deprecated and the documentation suggests that I use 'mini-css-extract-plugin'. So, I read the documentation for that and applied it but still nothing is working. I just want my webpack to bundle my .js and .css in separate files . Right now all of it is being pushed into 'bundle.js' and it does not render any css.
EDIT 2: Here is my new webpack.config.js and it is working as I wanted:
webpack.config.js:
webpack.config.js:
const path = require('path');
const webpack = require('webpack');
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
process.env.NODE_ENV = process.env.NODE_ENV || 'development'
if(process.env.NODE_ENV === 'test'){
require('dotenv').config({ path: '.env.test'})
}else if(process.env.NODE_ENV === 'development'){
require('dotenv').config({ path: '.env.development'})
}
module.exports = (env) => {
const isProd = env === 'production'
return{
entry: ['babel-polyfill','./src/app.js'],
output: {
path: path.join(__dirname, 'public', 'dist'),
filename: 'bundle.js'
},
module: {
rules: [{
loader: 'babel-loader',
test: /\.js$/,
exclude: /node_modules/
},
{
test: /\.(css)$/,
use: [MiniCssExtractPlugin.loader, 'css-loader']
},
{
test: /\.(s[ca]ss)$/,
use: [MiniCssExtractPlugin.loader, 'css-loader', 'sass-loader']
}
]
},
plugins:[
new MiniCssExtractPlugin({
filename:'styles.css'
}),
new webpack.DefinePlugin({
'process.env.FIREBASE_API_KEY': JSON.stringify(process.env.FIREBASE_API_KEY),
'process.env.FIREBASE_AUTH_DOMAIN': JSON.stringify(process.env.FIREBASE_AUTH_DOMAIN),
'process.env.FIREBASE_DATABASE_URL': JSON.stringify(process.env.FIREBASE_DATABASE_URL),
'process.env.FIREBASE_PROJECT_ID': JSON.stringify(process.env.FIREBASE_PROJECT_ID),
'process.env.FIREBASE_STORAGE_BUCKET': JSON.stringify(process.env.FIREBASE_STORAGE_BUCKET),
'process.env.FIREBASE_MESSAGE_SENDER_ID': JSON.stringify(process.env.FIREBASE_MESSAGE_SENDER_ID),
'process.env.FIREBASE_APP_ID': JSON.stringify(process.env.FIREBASE_APP_ID)
})
],
devtool: isProd ? 'source-map' :'inline-source-map',
devServer: {
contentBase: path.join(__dirname, 'public'),
historyApiFallback: true,
publicPath: '/dist'
}
}
}
Alright I finally have an answer for all of this. So I essentially had to update a lot of my webpack due to deprecated modules. I ended up using 'mini-css-extract-plugin' and found out how to set it up. If anyone is working on a project using Nodejs version 16 and up, try this for the webpack and see if it works. I'll post my results in the initial question.

Chrome is not communicating changes in my browser to my local files

The Issue:
I'm trying to use chrome workspaces / source maps to update my sass partials as I edit CSS in chrome dev tools. Chrome is detecting my sass partials from source maps I setup in webpack, but giving me the error "Changes to this file were not saved to the file system." when I try to save the changes from the sources tab in chrome dev tools.
Moreover, in the styles tab of chrome dev tools, despite chrome knowing which properties are connected to which sass partials, changing the styles there doesn't update the partial files in the sources tab.
Chrome is not communicating changes in my browser to my local files, despite the sass partials showing up as source mapped in the chrome dev tools, and despite me setting up a workstation.
So far:
I set up a workspace in chrome and added the folder for the project
Disabled all my chrome extensions
Made sure 'enable css source maps' was true in chrome settings
I believe the problem might be my webpack config, since this is the first time I've made a custom webpack config, and I basically fiddled around with it until it worked. It could (probably not) be a problem with with a dependency, so I'll also add my package.json file.
Sass partial detected in chrome inspector
Sass partials showing up in sources tab:
Error Message
Webpack config file:
const path = require('path')
const MiniCssExtractPlugin = require("mini-css-extract-plugin")
const HtmlWebpackPlugin = require('html-webpack-plugin')
module.exports = {
entry: ['#babel/polyfill', './src/index.js'],
output: {
path: path.resolve(__dirname, './dist'),
filename: 'bundle.js',
publicPath: '/'
},
devServer: {
contentBase: 'dist',
historyApiFallback: true
},
plugins: [
new HtmlWebpackPlugin({
filename: 'index.html',
template: './src/public/index.html'
}),
new MiniCssExtractPlugin({
filename: "[name].css",
chunkFilename: "[id].css"
})
],
module: {
rules: [
{
test: /\.sass$/,
use: [
"style-loader",
{ loader: 'css-loader', options: { sourceMap: true} },
{ loader: 'sass-loader', options: { sourceMap: true } }
],
},
{
test: /\.css$/,
use: [
"style-loader",
"css-loader"
]
},
{
test: /\.js$/,
exclude: /node_modules/,
use: [
"babel-loader"
]
}
]
}
}
Package.json:
{
"name": "css",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"dev": "webpack --mode development",
"build": "webpack --mode production",
"start": "webpack-dev-server --mode development --open"
},
"author": "",
"license": "ISC",
"devDependencies": {
"#babel/core": "^7.6.4",
"#babel/plugin-proposal-class-properties": "^7.5.5",
"#babel/preset-env": "^7.6.3",
"#babel/preset-react": "^7.6.3",
"babel-eslint": "^10.0.3",
"babel-loader": "^8.0.6",
"css-loader": "^3.2.0",
"eslint": "^6.5.1",
"eslint-plugin-react": "^7.16.0",
"html-webpack-plugin": "^3.2.0",
"mini-css-extract-plugin": "^0.8.0",
"node-sass": "^4.12.0",
"sass-loader": "^8.0.0",
"style-loader": "^1.0.0",
"webpack": "^4.41.1",
"webpack-cli": "^3.3.9",
"webpack-dev-server": "^3.8.2"
},
"dependencies": {
"#babel/polyfill": "^7.6.0",
"react": "^16.10.2",
"react-dom": "^16.10.2",
"react-router-dom": "^5.1.2"
},
"eslintConfig": {
"extends": [
"eslint:recommended",
"plugin:react/recommended"
],
"env": {
"browser": true,
"node": true
}
},
"eslintIgnore": [
"webpack.config.js"
]
}
This is no longer supported in Chrome :( Relevant issue is marked as "won't fix".
https://bugs.chromium.org/p/chromium/issues/detail?id=996226

Webpack --watch doesn't trigger for CSS files in specific directory

Using webpack --watch, changes to .pcss (PostCSS) files are not picked up when within [src/components/Main/]. Changes to .js files are picked up fine as well as .pcss files in other directories. Because my web app is isomorphic, ExtractTextPlugin is used to squish all the CSS together and push it into a single file.
Full code on GitHub.
This is on macOS 10.12.X.
webpack.config.js:
const path = require('path')
const webpack = require('webpack')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const babelPresetEnvExclude = require('./config/babel-preset-env.exclude')
const babelPluginRelay = ['relay', { schema: 'data/schema.graphqls', }]
const styleRules = {
test: /\.p?css$/,
exclude: /node_modules/,
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: [
{
loader: 'css-loader',
options: { importLoaders: 1 },
},
'postcss-loader',
],
}),
}
const fileRules = {
test: /\.((pn|sv|jpe?)g|gif)$/,
use: ['file-loader'],
}
const server = {
target: 'node',
entry: './build/unbundled/server.js',
output: {
filename: 'server.js',
path: path.resolve(__dirname, 'build')
},
resolve: {
extensions: ['.js', '.jsx'],
},
module: {
rules: [
{
test: /\.jsx?$/,
exclude: /(node_modules|bower_components)/,
use: [{
loader: 'babel-loader',
options: {
plugins: [babelPluginRelay],
},
}],
},
styleRules,
fileRules,
]
},
devtool: 'source-map',
plugins: [
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'development')
}),
// Overwrites the same file created by the browser webpack config. A loader
// needs to be specified to take care of the import statements and it wont
// work without also outputting a file. There has to be a better way to
// handle this, but I want to focus on other parts for now.
// #todo: make this less bad.
new ExtractTextPlugin('public/main.css'),
]
}
const browser = {
target: 'web',
entry: './build/unbundled/browser.js',
output: {
filename: 'bundle.js',
path: path.resolve(__dirname, 'build/public')
},
resolve: {
extensions: ['.js', '.jsx'],
},
module: {
rules: [
{
test: /\.jsx?$/,
exclude: /(node_modules|bower_components)/,
use: [{
loader: 'babel-loader',
options: {
presets: [
['env', {
debug: true,
useBuiltIns: true,
targets: { browsers: ['last 2 versions'] },
exclude: babelPresetEnvExclude
}]
],
plugins: [babelPluginRelay],
},
}],
},
styleRules,
fileRules,
]
},
devtool: 'source-map',
plugins: [
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'development')
}),
new ExtractTextPlugin('main.css'),
]
}
console.log('NODE_ENV', JSON.stringify(process.env.NODE_ENV || 'development'))
module.exports = [browser, server]
package.json:
{
"name": "rtm-owl",
"version": "1.0.0",
"main": "index.js",
"author": "boring#example.com",
"license": "MIT",
"scripts": {
"relay": "relay-compiler --src ./build/unbundled --schema data/schema.graphqls",
"build": "tsc --pretty && npm run relay && webpack --progress",
"debug": "npm run build && node --inspect build/server.js",
"debug-brk": "npm run build && node --inspect-brk build/server.js",
"start": "node build/server.js",
"watch": "concurrently --kill-others 'tsc --pretty --watch' 'relay-compiler --src ./build/unbundled --schema data/schema.graphqls --watch' 'webpack --watch' 'nodemon build/server.js'"
},
"devDependencies": {
"#types/chart.js": "^2.6.1",
"#types/debug": "^0.0.30",
"#types/express": "^4.0.36",
"#types/fs-extra": "^4.0.0",
"#types/isomorphic-fetch": "^0.0.34",
"#types/lodash": "^4.14.71",
"#types/morgan": "^1.7.32",
"#types/react": "^16.0.0",
"#types/react-chartjs-2": "^2.0.2",
"#types/react-dom": "^15.5.1",
"#types/react-redux": "^4.4.47",
"#types/serialize-javascript": "^1.3.1",
"autoprefixer": "^7.1.2",
"babel-core": "^6.25.0",
"babel-loader": "^7.1.1",
"babel-plugin-relay": "^1.1.0",
"babel-polyfill": "^6.23.0",
"babel-preset-env": "^1.6.0",
"concurrently": "^3.5.0",
"css-loader": "^0.28.4",
"extract-text-webpack-plugin": "^3.0.0",
"file-loader": "^0.11.2",
"fs-extra": "^4.0.0",
"isomorphic-fetch": "^2.2.1",
"nodemon": "^1.11.0",
"postcss-css-variables": "^0.7.0",
"postcss-import": "^10.0.0",
"postcss-loader": "^2.0.6",
"postcss-nested": "^2.1.0",
"relay-compiler": "^1.1.0",
"relay-runtime": "^1.1.0",
"serialize-javascript": "^1.3.0",
"style-loader": "^0.18.2",
"typescript": "^2.4.1",
"webpack": "^3.0.0"
},
"dependencies": {
"chart.js": "^2.6.0",
"debug": "^2.6.8",
"express": "^4.15.3",
"farce": "^0.2.1",
"found": "^0.3.1",
"found-relay": "^0.3.0-alpha.4",
"lodash": "^4.17.4",
"morgan": "^1.8.2",
"react": "^15.6.1",
"react-chartjs-2": "^2.5.5",
"react-dom": "^15.6.1",
"react-redux": "^5.0.5",
"react-relay": "^1.0.0",
"redux": "^3.7.2"
}
}
I encountered similar behaviour, webpack --watch does not react to changes in css files on macOS 10.14. I used the basic style-loader and css-loader and require my css files like require('./style.css').
Solved by switching to nodemon. In my package.json the following setup runs webpack whenever js or css files become modified.
...
scripts: {
"build": "webpack",
"watchbuild": "nodemon --watch ./ --ext js,css --ignore dist --exec \"npm run build\"",
...
},
devDependencies: {
"nodemon": "^2.0.4",
"webpack": "^4.39.3",
...
}
...
The setup can be easily customized to watch more file types and to execute a series of commands. For example nodemon --watch ./ --ext js,ejs,css,pcss --ignore dist --exec 'npm run lint && npm run build' will also watch ejs templates and pcss styles and run linter before build.
Note that I had to ignore my build directory dist to prevent infinite build loop. Note also \" instead of ' to provide compatibility between macOS and Windows.

Configuration for enabling hot style-loader in Webpack for syncing css

I'm trying to enable hot style-loader in Webpack but I can not find the right configuration for it. Here's my webpack.config.js:
const webpack = require('webpack');
const path = require('path');
const buildPath = path.resolve(__dirname, 'build');
const nodeModulesPath = path.resolve(__dirname, 'node_modules');
const TransferWebpackPlugin = require('transfer-webpack-plugin');
const config = {
entry: [
'webpack/hot/dev-server',
'webpack/hot/only-dev-server',
path.join(__dirname, '/src/app/app.js'),
],
resolve: {
extensions: ["", ".js"],
},
devServer: {
contentBase: 'src/www',
devtool: 'eval',
hot: true,
inline: true,
port: 3232,
host: '0.0.0.0',
},
devtool: 'eval',
output: {
path: buildPath,
filename: 'app.js',
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new TransferWebpackPlugin(
[{ from: 'www' }],
path.resolve(__dirname, "src")
),
],
module: {
loaders: [
{
test: /\.js$/,
loaders: ['react-hot', 'babel-loader'],
exclude: [nodeModulesPath],
},
{
test: /\.css$/,
loader: "style!css",
},
],
},
eslint: {
configFile: '.eslintrc',
},
};
module.exports = config;
And my package.js file:
{
"name": "test-material-ui",
"version": "0.0.0-beta.1",
"description": "Sample project that uses material-ui",
"scripts": {
"start": "webpack-dev-server --config webpack.config.js --progress --inline --colors",
"build": "webpack -p --define process.env.NODE_ENV='\"production\"' --config webpack-production.config.js --progress --colors",
"lint": "eslint src && echo \"eslint: no lint errors\""
},
"private": true,
"devDependencies": {
"babel-core": "^6.3.26",
"babel-eslint": "^6.0.0",
"babel-loader": "^6.2.4",
"babel-preset-es2015": "^6.3.13",
"babel-preset-react": "^6.3.13",
"copy-webpack-plugin": "^2.1.3",
"css-loader": "^0.23.1",
"eslint": "^2.5.1",
"eslint-plugin-react": "^4.0.0",
"html-webpack-plugin": "^2.7.2",
"react-hot-loader": "^1.3.0",
"style-loader": "^0.13.1",
"transfer-webpack-plugin": "^0.1.4",
"webpack": "^1.12.9",
"webpack-dev-server": "^1.14.0"
},
"dependencies": {
"flexboxgrid": "^6.3.0",
"material-ui": "^0.15.0-beta.1",
"react": "^15.0.1",
"react-addons-css-transition-group": "^15.0.1",
"react-dom": "^15.0.1",
"react-redux": "^4.4.5",
"react-tap-event-plugin": "^1.0.0",
"redux": "^3.4.0"
}
}
But no matter how I configure it, I can not get the hot sync working (for .css, for .js files it works just fine)! Can someone please show me the right way to do so?
Make sure that you require the css in Javascript.
Here's a link to the documentation that explains it: https://webpack.github.io/docs/stylesheets.html

Resources