1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- const path = require('path')
- const webpack = require('webpack')
- const HtmlWebpackPlugin = require('html-webpack-plugin')
- const isDev = process.env.NODE_ENV === 'development'
- module.exports = {
- resolve: {
- extensions: ['.ts', '.tsx', '.js', '.json'],
- },
- module: {
- rules: [
- {
- test: /\.(ts|js)x?$/,
- use: [
- {
- loader: 'babel-loader',
- options: {
- cacheDirectory: true,
- cacheCompression: false,
- compact: !isDev,
- },
- },
- ],
- // exclude: path.resolve(__dirname, '../node_modules'),
- },
- {
- test: /\.(png|jpg|gif)$/i,
- use: [
- {
- loader: 'url-loader',
- options: {
- limit: 10000,
- name: 'static/media/[name].[hash:8].[ext]',
- },
- },
- ],
- exclude: path.resolve(__dirname, '../node_modules'),
- },
- {
- test: /\.(woff|woff2|eot|ttf|otf)$/,
- use: ['file-loader'],
- exclude: path.resolve(__dirname, '../node_modules'),
- },
- {
- test: /\.(rar|doc)$/,
- use: [
- {
- loader: 'file-loader',
- options: {
- name: 'static/assets/[name].[ext]',
- },
- },
- ],
- exclude: path.resolve(__dirname, '../node_modules'),
- },
- ],
- },
- plugins: [
- new webpack.NamedModulesPlugin(),
- new webpack.BannerPlugin('nick 291375086@qq.com'),
- new HtmlWebpackPlugin({
- template: path.resolve(__dirname, './index.html'),
- title: '智慧工地-供应商平台',
- filename: 'index.html',
- chunks: ['index'],
- }),
- new HtmlWebpackPlugin({
- template: path.resolve(__dirname, './index.html'),
- title: '供应商公示',
- filename: 'publicity.html',
- chunks: ['publicity'],
- }),
- ],
- }
|