1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- const path = require('path');
- const { CleanWebpackPlugin } = require('clean-webpack-plugin');
- const HtmlWebpackPlugin = require('html-webpack-plugin');
- const VueLoaderPlugin = require('vue-loader/lib/plugin');
- module.exports = {
- entry:{
- app: path.resolve(__dirname,'src','index.js'),
- //test:path.resolve(__dirname,'src/test','test.js')
- },
- plugins: [
- new CleanWebpackPlugin(),
- new VueLoaderPlugin(),
- new HtmlWebpackPlugin({
- title:'预诊',
- template:path.resolve(__dirname,'src','index.html'),
- }),
- /*new HtmlWebpackPlugin({
- title:'index',
- filename:'index.html', //打包后的文件名,必填,否则都会生成index.html,且后面的覆盖前面的
- template:path.resolve(__dirname,'src','index.html'),
- chunks:['app'],
- }),
- new HtmlWebpackPlugin({
- title:'test',
- filename:'test.html',
- template:path.resolve(__dirname,'src/test','test.html'),
- chunks:['test'],
- }),*/
- ],
- output: {
- filename: "[name].bundle.js",
- path: path.resolve(__dirname,'dist')
- },
- module: {
- rules: [{
- test:/\.css$/,
- use:[
- 'style-loader',
- 'css-loader',
- ]
- },{
- test:/\.less$/,
- use:[
- 'style-loader',
- 'css-loader',
- 'less-loader'
- ]
- },{
- test: /\.(png|svg|jpg|jpeg|gif)/,
- use:[{
- loader: "file-loader",
- options:{
- limit:5000,
- name: 'imgs/[name].[ext]'
- }
- }]
- },{
- test:/\.vue$/,
- use:[
- 'vue-loader'
- ]
- },{
- test: /\.js$/,
- exclude: file => (
- /node_modules/.test(file) &&
- !/\.vue\.js/.test(file)
- ),
- use: {
- loader: 'babel-loader',
- options: {
- presets: ['@babel/preset-env'],
- plugins: ['@babel/plugin-transform-runtime']
- }
- }
- }]
- },
- resolve: {
- alias: {
- 'vue$':'vue/dist/vue.esm.js' //让vue使用compiler模式,默认runtime模式要用render初始化
- }
- }
- };
|