123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- var path = require('path');
- var HtmlWebpackPlugin = require('html-webpack-plugin');
- var VueLoaderPlugin = require('vue-loader/lib/plugin');
- const webpack = require('webpack');
- var config = {
- entry: './src/main.js',
- output: {
- path: path.resolve(__dirname + '/manageWeb'),//打包生成文件地址
- filename: '[name].build.js',//生成文件ming
- // publicPath: './'//文件输出的公共路径
- },
- module: {
- rules: [
- {
- test: '/\.js$/',
- use: [
- {
- loader: 'babel-loader',
- options: {
- presets: ['env']
- }
- }
- ],
- include: path.resolve(__dirname + '/src/'),
- exclude: /node_modules/,
- },
- {
- test: /\.css$/,
- use:['style-loader','css-loader']
- },
- {
- test: /\.sass$/,
- use:['vue-style-loader', 'css-loader', 'sass-loader' ],
- include: path.resolve(__dirname + '/src/'),
- exclude: /node_modules/
- },
- {
- test: /\.(jpg|png|gif|svg)$/,
- use: 'url-loader',
- include: path.resolve(__dirname + '/src/'),
- exclude: /node_modules/
- },
- {
- test: /\.(eot|svg|ttf|woff|woff2)$/,
- loader: 'file-loader'
- },
- {
- test: /\.vue$/,
- loader: 'vue-loader'
- }
- ]
- },
- resolve: {
- extensions: ['.js', '.jsx','.ts','.tsx', '.scss','.json','.css', '.vue'],
- alias: {
- 'vue$': 'vue/dist/vue.esm.js',
- "@": path.resolve(__dirname, 'src'),
- "components": path.resolve(__dirname, '/src/components'),
- "utils": path.resolve(__dirname + '/src/utils')
- },
- modules: ['node_modules']
- },
- plugins: [
- new HtmlWebpackPlugin({
- template: 'index.html',
- chunks: ['main']
- }),
- new VueLoaderPlugin(),
- new webpack.HotModuleReplacementPlugin()
- ],
- devServer: {
- historyApiFallback: true,
- noInfo: true
- }
- }
- module.exports = config;
|