$ node ./node_modules/.bin/webpack-dev-server --host XXX --port 80 --history-api-fallback --hot --config=./webpack.babel.js --env.api=alpha --env.flag=alpha
No message.
Using "setup" is deprecated and will be removed in the next major version. Please use the "before" and "after" hooks instead.
If "setup" was working fine for you until now, simply replace it with "before"
This is by design. Change your config to use before instead of setup as instructed by the message and the message will not be shown.
I understand the point but… where I've got any setup thing in my config? O_o
// webpack.config.js
import path from 'path'
import webpack from 'webpack'
import HtmlWebpackPlugin from 'html-webpack-plugin'
import babelConfig from './babel.config.js'
import envVars from './env.json'
const SRC_DIR = path.resolve(__dirname, 'src')
const DIST_DIR = path.resolve(__dirname, 'dist')
export default (env) => {
return {
// the source
entry: [
'react-hot-loader/patch',
`${SRC_DIR}/index.js`,
],
// the destination
output: {
path: DIST_DIR,
filename: 'index.js',
publicPath: '/'
},
resolve: {
alias: {
'~': `${SRC_DIR}`, // thanks to that, we can use import xxx from '~/file'
}
},
// active devtools
// devtool: 'eval',
devtool: 'cheap-module-inline-source-map',
// devtool: 'cheap-module-source-map',
// plugins
plugins: [
new HtmlWebpackPlugin({
template: 'src/index.html',
favicon: 'src/favicon.ico',
segmentToken: JSON.stringify(envVars[env.flag].SEGMENT_TOKEN),
}),
new webpack.DefinePlugin({
API_URL: JSON.stringify(envVars[env.api].API_URL),
JOURNAL_URL: JSON.stringify(envVars[env.flag].JOURNAL_URL),
FLAG: JSON.stringify(env.flag),
'process.env': {
'NODE_ENV': JSON.stringify('development')
}
}),
],
// what will be used for each type of code
module: {
rules: [
// javascript
{
test: /\.jsx?$/,
exclude: /node_modules/,
loader: 'babel-loader',
options: babelConfig,
},
// files
{
test: /\.(png|woff|woff2|eot|ttf|svg)$/,
use: {
loader: 'url-loader',
options: {
limit: 100000
}
}
},
// styles
{
test: /\.css$/,
exclude: /\.module\.css$/,
use: [
{
loader: 'style-loader',
},
{
loader: 'css-loader',
options: {
modules: false,
importLoaders: 1,
import: true,
alias: {
'~': `${SRC_DIR}`
}
}
},
{
loader: 'postcss-loader'
}
]
},
{
test: /\.module\.css$/,
use: [
{
loader: 'style-loader',
},
{
loader: 'css-loader',
options: {
modules: true,
importLoaders: 1,
localIdentName: '[path][name]--[local]-___[hash:base64:5]',
import: true,
alias: {
'~': `${SRC_DIR}`
}
}
},
{
loader: 'postcss-loader'
}
]
},
// images
{
test: /.*\.(gif|png|jpe?g|svg)$/i,
use: [
{
loader: 'file-loader'
}
]
}
]
}
}
}
Yep. Looks like we missed the position of those messages. Patch will be published.
Fixed in 8de5d0a2bf9916439b268b7b7d9ba2d613f35234 and published
Most helpful comment
Fixed in 8de5d0a2bf9916439b268b7b7d9ba2d613f35234 and published