Skip to content

Instantly share code, notes, and snippets.

@g-patel
Created February 14, 2017 20:40
Show Gist options
  • Save g-patel/73fafb7631a09b89de237f5d5fa6a8c6 to your computer and use it in GitHub Desktop.
Save g-patel/73fafb7631a09b89de237f5d5fa6a8c6 to your computer and use it in GitHub Desktop.
const webpack = require('webpack');
const helpers = require('./helpers');
const config = require('../config');
const path = require('path');
const projectRoot = path.resolve(__dirname, '../');
const utils = require('./utils');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const ENV = process.env.NODE_ENV || 'development';
module.exports = {
output: {
path: config.build.assetsRoot,
publicPath: ENV === 'production' ? config.build.assetsPublicPath : config.dev.assetsPublicPath,
filename: 'grpn-wh-components.js'/*,
sourceMapFilename: "[file].map"*/
},
resolve: {
extensions: ['', '.js', '.vue', '.json'],
fallback: [path.join(__dirname, '../node_modules')],
alias: {
'src': path.resolve(__dirname, '../src'),
'assets': path.resolve(__dirname, '../src/assets'),
'components': path.resolve(__dirname, '../src/components')
}
},
resolveLoader: {
fallback: [path.join(__dirname, '../node_modules')]
},
module: {
preLoaders: [
{
test: /\.vue$/,
loader: 'eslint',
include: projectRoot,
exclude: /node_modules/
},
{
test: /\.js$/,
loader: 'eslint',
include: projectRoot,
exclude: /node_modules/
}
],
loaders: [
{
test: /\.vue$/,
loader: 'vue'
},
{
test: /\.js$/,
loader: 'babel',
include: projectRoot,
exclude: /node_modules/
},
{
test: /\.json$/,
loader: 'json'
},
{
test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
loader: 'url',
query: {
limit: 10000,
name: utils.assetsPath('img/[name].[hash:7].[ext]')
}
},
{
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
loader: 'url',
query: {
limit: 10000,
name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
}
},
{
test: /\.js$/,
loader: 'unlazy'
}
]
},
eslint: {
formatter: require('eslint-friendly-formatter')
},
vue: {
loaders: utils.cssLoaders(),
postcss: [
require('autoprefixer')({
browsers: ['last 2 versions']
})
]
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment