Skip to content

Commit 9bb15fc

Browse files
committed
generated base landing page and broke webpack.
1 parent 2c0414c commit 9bb15fc

28 files changed

Lines changed: 9111 additions & 10484 deletions

old_webpack.config.js

Lines changed: 199 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,199 @@
1+
'use strict'
2+
3+
const webpack = require('webpack')
4+
const path = require('path')
5+
const CleanWebpackPlugin = require('clean-webpack-plugin')
6+
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin // eslint-disable-line prefer-destructuring
7+
const DotEnv = require('dotenv-webpack')
8+
const autoprefixer = require('autoprefixer')
9+
const glob = require('glob')
10+
const VueLoaderPlugin = require('vue-loader/lib/plugin')
11+
12+
const rootFiles = ['index', 'serviceWorkerInstaller', 'vendor']
13+
14+
const entry = glob
15+
.sync('./src/**/*.js')
16+
.reduce(
17+
(entries, entryFile) => Object.assign(entries, { [path.parse(entryFile).name]: entryFile }),
18+
{}
19+
)
20+
21+
module.exports = {
22+
entry,
23+
output: {
24+
filename: (chunkFileName) => rootFiles.some(file => file === chunkFileName.chunk.name) ? '[name].js' : '[name]/[name].js',
25+
path: path.resolve(__dirname, 'build')
26+
},
27+
target: 'web',
28+
mode: 'development',
29+
devServer: {
30+
contentBase: path.resolve(__dirname, 'src'),
31+
watchContentBase: true,
32+
compress: true,
33+
port: 3000,
34+
hot: true
35+
},
36+
resolve: {
37+
extensions: ['.js', '.vue'],
38+
alias: {
39+
vue: 'vue/dist/vue.js'
40+
}
41+
},
42+
module: {
43+
rules: [
44+
{
45+
test: /\.vue$/,
46+
loader: 'vue-loader'
47+
},
48+
{
49+
enforce: 'pre',
50+
test: /\.pug$/,
51+
exclude: /node_modules/,
52+
use: {
53+
loader: 'vue-pug-lint-loader',
54+
options: require('./.pug-lintrc.json')
55+
}
56+
},
57+
{
58+
test: /\.pug$/,
59+
oneOf: [
60+
// this applies to `<template lang="pug">` in Vue components
61+
{
62+
resourceQuery: /^\?vue/,
63+
use: ['pug-plain-loader']
64+
},
65+
{
66+
use: [
67+
{
68+
loader: 'file-loader',
69+
options: {
70+
name(file) {
71+
return file.includes('index') ? '[name].html' : '[name]/index.html'
72+
}
73+
}
74+
},
75+
'pug-plain-loader'
76+
]
77+
}
78+
]
79+
},
80+
{
81+
enforce: 'pre',
82+
test: /\.js$/,
83+
exclude: /node_modules/,
84+
use: {
85+
loader: 'eslint-loader',
86+
options: {
87+
configFile: '.eslintrc',
88+
cache: true,
89+
emitError: true,
90+
emitWarning: true
91+
}
92+
}
93+
},
94+
{
95+
test: /\.js$/,
96+
exclude: /node_modules/,
97+
use: 'babel-loader'
98+
},
99+
{
100+
test: /\.scss$/,
101+
exclude: /node_modules/,
102+
use: [
103+
{
104+
loader: 'style-loader',
105+
options: {
106+
hmr: true
107+
}
108+
},
109+
'css-loader',
110+
{
111+
loader: 'postcss-loader',
112+
options: {
113+
ident: 'postcss',
114+
plugins: () => [
115+
require('postcss-flexbugs-fixes'),
116+
autoprefixer({
117+
browsers: [
118+
'>1%',
119+
'last 4 versions',
120+
'Firefox ESR',
121+
'not ie <9'
122+
],
123+
flexbox: 'no-2009'
124+
})
125+
]
126+
}
127+
},
128+
{
129+
loader: 'sass-loader',
130+
options: {
131+
includePaths: [path.resolve(__dirname, 'src/scss')]
132+
}
133+
}
134+
]
135+
},
136+
{
137+
test: /\.css$/,
138+
use: [
139+
'style-loader',
140+
'css-loader',
141+
{
142+
loader: 'postcss-loader',
143+
options: {
144+
ident: 'postcss',
145+
plugins: () => [
146+
require('postcss-flexbugs-fixes'),
147+
autoprefixer({
148+
browsers: [
149+
'>1%',
150+
'last 4 versions',
151+
'Firefox ESR',
152+
'not ie <9'
153+
],
154+
flexbox: 'no-2009'
155+
})
156+
]
157+
}
158+
}
159+
]
160+
},
161+
{
162+
test: /\.(jpg|png|gif|otf)$/,
163+
use: 'file-loader?name=assets/[name].[ext]'
164+
},
165+
{
166+
test: /\.svg$/,
167+
loader: 'vue-svg-loader',
168+
options: {
169+
svgo: {
170+
plugins: [
171+
{cleanupIDs: false},
172+
{convertPathData: false},
173+
{mergePaths: false}
174+
]
175+
}
176+
}
177+
}
178+
]
179+
},
180+
plugins: [
181+
new CleanWebpackPlugin(['build']),
182+
new DotEnv(),
183+
new webpack.NamedModulesPlugin(),
184+
new webpack.HotModuleReplacementPlugin(),
185+
new BundleAnalyzerPlugin({
186+
openAnalyzer: false
187+
}),
188+
new VueLoaderPlugin()
189+
],
190+
devtool: 'eval',
191+
optimization: {
192+
splitChunks: {
193+
chunks: 'async'
194+
}
195+
},
196+
performance: {
197+
hints: false
198+
}
199+
}

0 commit comments

Comments
 (0)