Created
November 29, 2017 01:01
-
-
Save ramsaylanier/375961e34571eb1f0f66fc5ce1039379 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 'use strict' | |
| const path = require('path') | |
| const utils = require('./utils') | |
| const config = require('../config') | |
| const Config = require('config') | |
| const fs = require('fs') | |
| const vueLoaderConfig = require('./vue-loader.conf') | |
| fs.writeFileSync(path.resolve(__dirname, '../config/client.json'), JSON.stringify(Config)) | |
| function resolve (dir) { | |
| return path.join(__dirname, '..', dir) | |
| } | |
| 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'), | |
| 'config': resolve('config/client.json') | |
| } | |
| }, | |
| module: { | |
| rules: [ | |
| { | |
| test: /\.(js|vue)$/, | |
| loader: 'eslint-loader', | |
| enforce: 'pre', | |
| include: [resolve('src'), resolve('test')], | |
| options: { | |
| formatter: require('eslint-friendly-formatter') | |
| } | |
| }, | |
| { | |
| test: /\.vue$/, | |
| loader: 'vue-loader', | |
| options: vueLoaderConfig | |
| }, | |
| { | |
| test: /\.js$/, | |
| loader: 'babel-loader', | |
| include: [resolve('src'), resolve('test')] | |
| }, | |
| { | |
| test: /\.(graphql|gql)$/, | |
| exclude: /node_modules/, | |
| use: { | |
| loader: 'graphql-tag/loader' | |
| } | |
| }, | |
| { | |
| test: /\.(png|jpe?g|gif|svg)(\?.*)?$/, | |
| loader: 'url-loader', | |
| options: { | |
| limit: 10000, | |
| name: utils.assetsPath('img/[name].[hash:7].[ext]') | |
| } | |
| }, | |
| { | |
| test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/, | |
| loader: 'url-loader', | |
| options: { | |
| limit: 10000, | |
| name: utils.assetsPath('media/[name].[hash:7].[ext]') | |
| } | |
| }, | |
| { | |
| test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/, | |
| loader: 'url-loader', | |
| options: { | |
| limit: 10000, | |
| name: utils.assetsPath('fonts/[name].[hash:7].[ext]') | |
| } | |
| } | |
| ] | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment