1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- var path = require('path')
- var utils = require('./utils')
- var config = require('../config')
- var vueLoaderConfig = require('./vue-loader.conf')
- const webpack = require('webpack')
- function resolve(dir) {
- return path.join(__dirname, '..', dir)
- }
- const src = path.resolve(__dirname, '../src')
- module.exports = {
- entry: {
- app: './src/main.js'
- },
- output: {
- path: config.build.assetsRoot,
- filename: '[name].js',
- publicPath: process.env.NODE_ENV === 'production' ? config.build.assetsPublicPath : config.dev.assetsPublicPath
- },
- resolve: {
- extensions: ['.js', '.vue', '.json'],
- alias: {
- 'vue$': 'vue/dist/vue.esm.js',
- '@': resolve('src'),
- 'src': path.resolve(__dirname, '../src'),
- 'assets': path.resolve(__dirname, '../src/assets'),
- 'components': path.resolve(__dirname, '../src/components'),
- 'views': path.resolve(__dirname, '../src/views'),
- 'styles': path.resolve(__dirname, '../src/styles'),
- 'api': path.resolve(__dirname, '../src/api'),
- 'utils': path.resolve(__dirname, '../src/utils'),
- 'store': path.resolve(__dirname, '../src/store'),
- 'router': path.resolve(__dirname, '../src/router'),
- // 'static': path.resolve(__dirname, '../static')
- 'jquery': 'jquery'
- }
- },
- plugins: [
- new webpack.ProvidePlugin({
- $: 'jquery',
- jQuery: 'jquery'
- })
- ],
- module: {
- rules: [{
- test: /\.vue$/,
- loader: 'vue-loader',
- options: vueLoaderConfig
- }, {
- test: /\.js$/,
- loader: 'babel-loader',
- include: [resolve('src'), resolve('test')]
- }, {
- test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
- loader: 'url-loader',
- options: {
- limit: 10000,
- name: utils.assetsPath('img/[name].[hash:7].[ext]')
- }
- }, {
- test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
- loader: 'url-loader',
- options: {
- limit: 10000,
- name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
- }
- }]
- }
- }
|