1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- const path = require('path');
- const HtmlWebpackPlugin = require('html-webpack-plugin');
- const MiniCssExtractPlugin = require('mini-css-extract-plugin');
- const webpack = require('webpack');
- const proxyHost = "http://192.168.2.236:5050";
- module.exports = {
- entry:'./src/js/index.js',
- output:{
- filename: "main.js",
- path:path.resolve(__dirname, 'dist'),
- publicPath:'/'
- },
- mode:'development',
- devtool: 'inline-source-map',
- devServer: {
- contentBase: './dist',
- proxy:{
- '/api':proxyHost
- },
- hot: true
- },
- plugins: [
- new HtmlWebpackPlugin({
- title: '11111',
- template:'./src/index.html',
- filename:'index.html'
- }),
- new HtmlWebpackPlugin({
- title: 'test',
- template:'./src/test.html',
- filename:'test.html'
- }),
- new MiniCssExtractPlugin({
- // Options similar to the same options in webpackOptions.output
- // both options are optional
- filename: '[name].css',
- chunkFilename: '[id].css',
- }),
- ],
- module: {
- rules: [
- {
- test: /\.js$/,
- use: "imports-loader?$=jquery"
- },
- {
- test: /\.css$/,
- use: [
- {
- loader: MiniCssExtractPlugin.loader,
- options: {
- // you can specify a publicPath here
- // by default it uses publicPath in webpackOptions.output
- },
- },
- 'css-loader',
- ],
- },
- {
- test:/\.less$/,
- use:['style-loader','css-loader','less-loader']
- },
- {
- test: /\.(png|svg|jpg|gif)$/,
- use: [
- 'file-loader'
- ]
- }
- ]
- }
- }
|