-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
generated base landing page and broke webpack.
- Loading branch information
Showing
28 changed files
with
9,111 additions
and
10,484 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,199 @@ | ||
'use strict' | ||
|
||
const webpack = require('webpack') | ||
const path = require('path') | ||
const CleanWebpackPlugin = require('clean-webpack-plugin') | ||
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin // eslint-disable-line prefer-destructuring | ||
const DotEnv = require('dotenv-webpack') | ||
const autoprefixer = require('autoprefixer') | ||
const glob = require('glob') | ||
const VueLoaderPlugin = require('vue-loader/lib/plugin') | ||
|
||
const rootFiles = ['index', 'serviceWorkerInstaller', 'vendor'] | ||
|
||
const entry = glob | ||
.sync('./src/**/*.js') | ||
.reduce( | ||
(entries, entryFile) => Object.assign(entries, { [path.parse(entryFile).name]: entryFile }), | ||
{} | ||
) | ||
|
||
module.exports = { | ||
entry, | ||
output: { | ||
filename: (chunkFileName) => rootFiles.some(file => file === chunkFileName.chunk.name) ? '[name].js' : '[name]/[name].js', | ||
path: path.resolve(__dirname, 'build') | ||
}, | ||
target: 'web', | ||
mode: 'development', | ||
devServer: { | ||
contentBase: path.resolve(__dirname, 'src'), | ||
watchContentBase: true, | ||
compress: true, | ||
port: 3000, | ||
hot: true | ||
}, | ||
resolve: { | ||
extensions: ['.js', '.vue'], | ||
alias: { | ||
vue: 'vue/dist/vue.js' | ||
} | ||
}, | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.vue$/, | ||
loader: 'vue-loader' | ||
}, | ||
{ | ||
enforce: 'pre', | ||
test: /\.pug$/, | ||
exclude: /node_modules/, | ||
use: { | ||
loader: 'vue-pug-lint-loader', | ||
options: require('./.pug-lintrc.json') | ||
} | ||
}, | ||
{ | ||
test: /\.pug$/, | ||
oneOf: [ | ||
// this applies to `<template lang="pug">` in Vue components | ||
{ | ||
resourceQuery: /^\?vue/, | ||
use: ['pug-plain-loader'] | ||
}, | ||
{ | ||
use: [ | ||
{ | ||
loader: 'file-loader', | ||
options: { | ||
name(file) { | ||
return file.includes('index') ? '[name].html' : '[name]/index.html' | ||
} | ||
} | ||
}, | ||
'pug-plain-loader' | ||
] | ||
} | ||
] | ||
}, | ||
{ | ||
enforce: 'pre', | ||
test: /\.js$/, | ||
exclude: /node_modules/, | ||
use: { | ||
loader: 'eslint-loader', | ||
options: { | ||
configFile: '.eslintrc', | ||
cache: true, | ||
emitError: true, | ||
emitWarning: true | ||
} | ||
} | ||
}, | ||
{ | ||
test: /\.js$/, | ||
exclude: /node_modules/, | ||
use: 'babel-loader' | ||
}, | ||
{ | ||
test: /\.scss$/, | ||
exclude: /node_modules/, | ||
use: [ | ||
{ | ||
loader: 'style-loader', | ||
options: { | ||
hmr: true | ||
} | ||
}, | ||
'css-loader', | ||
{ | ||
loader: 'postcss-loader', | ||
options: { | ||
ident: 'postcss', | ||
plugins: () => [ | ||
require('postcss-flexbugs-fixes'), | ||
autoprefixer({ | ||
browsers: [ | ||
'>1%', | ||
'last 4 versions', | ||
'Firefox ESR', | ||
'not ie <9' | ||
], | ||
flexbox: 'no-2009' | ||
}) | ||
] | ||
} | ||
}, | ||
{ | ||
loader: 'sass-loader', | ||
options: { | ||
includePaths: [path.resolve(__dirname, 'src/scss')] | ||
} | ||
} | ||
] | ||
}, | ||
{ | ||
test: /\.css$/, | ||
use: [ | ||
'style-loader', | ||
'css-loader', | ||
{ | ||
loader: 'postcss-loader', | ||
options: { | ||
ident: 'postcss', | ||
plugins: () => [ | ||
require('postcss-flexbugs-fixes'), | ||
autoprefixer({ | ||
browsers: [ | ||
'>1%', | ||
'last 4 versions', | ||
'Firefox ESR', | ||
'not ie <9' | ||
], | ||
flexbox: 'no-2009' | ||
}) | ||
] | ||
} | ||
} | ||
] | ||
}, | ||
{ | ||
test: /\.(jpg|png|gif|otf)$/, | ||
use: 'file-loader?name=assets/[name].[ext]' | ||
}, | ||
{ | ||
test: /\.svg$/, | ||
loader: 'vue-svg-loader', | ||
options: { | ||
svgo: { | ||
plugins: [ | ||
{cleanupIDs: false}, | ||
{convertPathData: false}, | ||
{mergePaths: false} | ||
] | ||
} | ||
} | ||
} | ||
] | ||
}, | ||
plugins: [ | ||
new CleanWebpackPlugin(['build']), | ||
new DotEnv(), | ||
new webpack.NamedModulesPlugin(), | ||
new webpack.HotModuleReplacementPlugin(), | ||
new BundleAnalyzerPlugin({ | ||
openAnalyzer: false | ||
}), | ||
new VueLoaderPlugin() | ||
], | ||
devtool: 'eval', | ||
optimization: { | ||
splitChunks: { | ||
chunks: 'async' | ||
} | ||
}, | ||
performance: { | ||
hints: false | ||
} | ||
} |
Oops, something went wrong.