using webpck-dev-server to build
webpack configlessantd
webpack configuration here
const path = require("path")
const webpack = require("webpack")
function resolve (dir) {
return path.join(__dirname, "..", dir)
}
const webpackConfig = {
entry: "./example/index.js",
output: {
path: "/",
filename: "[name].[hash:7].js"
},
resolve: {
extensions: [".js", ".jsx", ".json"],
alias: {
"src": path.resolve(__dirname, "../src"),
"example": path.resolve(__dirname, "../example")
},
modules: ["../src/components", "node_modules"]
},
devServer: {
host: "0.0.0.0",
port: 6666,
publicPath: "/",
noInfo: true
},
module: {
rules: [
{
test: /\.(jsx?| js)$/,
loader: "babel-loader",
include: [resolve("example"), resolve("src")],
query: {
presets: ["env", "stage-0", "react"],
plugins: [
"babel-plugin-transform-decorators-legacy",
"transform-class-properties",
["import", {
"libraryName": "antd",
"style": true
}],
"transform-runtime",
"transform-object-rest-spread"
]
}
},
{
test: /\.(less|css)$/,
use: [
"style-loader",
"css-loader",
{
loader: "less-loader",
options: {
javascriptEnabled: true
}
}
],
include: [resolve("example"), resolve("src"), resolve("node_modules/antd/lib")]
// exclude: /(node_modules)/
}
]
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new webpack.NamedModulesPlugin(),
new webpack.DefinePlugin({
"process.env.NODE_ENV": JSON.stringify("development")
})
]
}
module.exports = webpackConfig
but if you parse the antd style, the service will jam directly and ask for God"s guidance
.