| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- var path = require('path');
- const { VueLoaderPlugin } = require('vue-loader');
- const ESLintPlugin = require('eslint-webpack-plugin');
- const MiniCssExtractPlugin = require('mini-css-extract-plugin');
- module.exports = {
- module: {
- rules: [
- {
- test: /\.vue$/,
- loader: 'vue-loader',
- },
- {
- test: /\.js$/,
- loader: 'babel-loader',
- // include: [
- // path.resolve(__dirname, './node_modules/pc-component-v3/dist/pc-component-v3.js'),
- // ],
- exclude: /node_modules/,
- // exclude: file => (
- // /node_modules/.test(file) &&
- // !/\.vue\.js/.test(file)
- // ),
- },
- {
- test: /\.css$/,
- use: (process.env.NODE_ENV === 'production') ? [
- {
- loader: MiniCssExtractPlugin.loader,
- options: {
- publicPath: '../',
- },
- },
- 'css-loader'] : ['style-loader', 'css-loader'],
- },
- {
- test: /\.(json5?|ya?ml)$/, // target json, json5, yaml and yml files
- type: 'javascript/auto',
- loader: '@intlify/vue-i18n-loader',
- include: [ // Use `Rule.include` to specify the files of locale messages to be pre-compiled
- //path.resolve(__dirname, 'src/locales'),
- path.resolve(__dirname, 'client-base-v4/src/locales'),
- path.resolve(__dirname, 'client-eam-v3/src/locales'),
- path.resolve(__dirname, 'client-role-v3/src/locales'),
- ],
- },
- {
- // webpack5 通过资源模块来处理图片
- test: /\.(png|jpg|gif|svg)$/,
- type: 'asset/resource',
- parser: {
- dataUrlCondition: {
- maxSize: 10240,
- },
- },
- generator: {
- filename: './client-base-v4-image/[name][ext][query]',
- },
- },
- {
- test: /\.(eot|woff|woff2|ttf)$/,
- type: 'asset/resource',
- generator: {
- filename: './client-base-v4-font/[name].[ext]?[hash]',
- },
- },
- ],
- },
- resolve: {
- alias: {
-
- },
- },
- performance: {
- hints: false,
- },
-
- externals: {
- 'jquery': "window.jquery",
- '$': "window.jquery",
- 'bootstrap': 'bootstrap',
- 'BootstrapDialog': 'BootstrapDialog',
- 'echarts': 'echarts',
- 'dayjs': 'dayjs',
- 'vue': 'Vue',
- 'vue-i18n': 'VueI18n',
- 'vue-router': 'VueRouter',
- 'vuex': 'Vuex',
- 'sortablejs': 'Sortable',
- },
-
- plugins: [
- new VueLoaderPlugin(),
- new ESLintPlugin({
- extensions: ['js', 'vue'],
- // 自动修复。
- // 自从eslint推出--fix命令后,如果觉得eslint格式化规则已经够用的话,其实也可以不用prettier了。
- fix: true,
- }),
- ],
- };
|