@beisen/ethos
Version:
beisencloud pc react components
68 lines (61 loc) • 1.52 kB
JavaScript
const path = require('path');
const CodeSplitWebpackPlugin = require('@beisen/code-split-component/webpack');
const webpack = require('webpack');
const root = path.resolve(process.cwd(), './');
const entry = {
'ethos': path.resolve(root, './src/index')
};
const host = 'localhost';
const port = 3002;
const externals = require("./extenals");
module.exports = {
entry: entry,
devtool: "inline-source-map",
externals: externals,
output: {
filename: "[name].js",
library: "@beisen/ethos",
libraryTarget: "umd",
path: path.resolve(root, "./dist/"),
publicPath: `http://${host}:${port}/ethos/`, // 静态资源请求
},
module: {
loaders: [
{
test: /\.js[x]?$/,
loader: 'babel',
exclude: /node_modules/
},
{
test: /\.css$/, loaders: ["style-loader",
"css-loader"]
},
{
test: /\.scss$/, loaders: ["style-loader",
"css-loader", "sass-loader"]
},
{
test: /\.(ttf|eot|svg|woff(2)?)(\?[^('|")]*)?$/,
loader: "file-loader?name=images/[hash:8].[name].[ext]"
},
{
test: /\.(png|jpg|gif)$/,
loader: "file-loader?name=images/[hash:8].[name].[ext]"
}
]
},
devServer: {
contentBase: path.resolve(root, "./dist/"),
port,
publicPath: "/ethos/"
},
plugins: [
new CodeSplitWebpackPlugin(),
new webpack.DefinePlugin({
'__NOT_USE_RUNTIME_PUBLIC_PATH__': 'true'
}),
],
node: {
fs: "empty"
}
}