帆软决策平台数据连接界面库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

71 lines
1.7 KiB

const path = require('path');
const HtmlWebpackPlugin = require("html-webpack-plugin");
const CopyPlugin = require('copy-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
module.exports = env => {
const htmlWebpackPlugin = new HtmlWebpackPlugin({
template: path.join(__dirname, `src/index.html`),
filename: "./index.html"
});
return{
mode: "development",
entry: path.join(__dirname, `src/index.ts`),
devtool: "source-map",
output: {
path: __dirname + '/dist',
filename: `index.js`,
publicPath: ''
},
resolve: {
extensions: [ '.ts', '.js' ],
alias:{
"@ui": path.resolve("src/ui"),
}
},
plugins: [htmlWebpackPlugin, new MiniCssExtractPlugin({filename: `style.css`}), new CopyPlugin([
{ from: 'src/lib', to: 'lib' }
])],
module: {
rules: [
{
test:/\.css$/,
exclude: /node_modules/,
loader: ['style-loader','css-loader'],
},
{
test:/\.scss$/,
exclude: /node_modules/,
use: [
{
loader: MiniCssExtractPlugin.loader,
options: {
publicPath: './',
hmr: process.env.NODE_ENV === 'development',
},
},
'css-loader','sass-loader'
]
},{
test:/(\.png|\.gif|\.svg)$/,
exclude: /node_modules/,
use:[{
loader: 'file-loader',
options: {
name:'img/[name].[ext]'
},
}]
},
{
test: /\.ts$/,
exclude: /node_modules/,
loader: 'ts-loader'
}
]
},
devServer: {
port: 3003
}
};
}