forked from aeternity/aepp-boilerplate-vue
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
moves most config to webpack and enables purgecss for prod builds
- Loading branch information
keno dressel
committed
Nov 21, 2019
1 parent
e52ab27
commit 049f932
Showing
8 changed files
with
225 additions
and
191 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
This file was deleted.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file was deleted.
Oops, something went wrong.
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,121 @@ | ||
const path = require('path'); | ||
const HtmlWebpackPlugin = require('html-webpack-plugin'); | ||
|
||
const HtmlWebpackHarddiskPlugin = require('html-webpack-harddisk-plugin'); | ||
// Cleans dist folder before building for fresh build | ||
const {CleanWebpackPlugin} = require('clean-webpack-plugin'); | ||
const {VueLoaderPlugin} = require('vue-loader'); | ||
// const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin | ||
const FaviconsWebpackPlugin = require('favicons-webpack-plugin'); | ||
|
||
const distFolder = path.resolve(__dirname, 'dist'); | ||
|
||
module.exports = { | ||
resolve: { | ||
extensions: ['.vue', '.css', '.js'], | ||
alias: { | ||
'~': path.resolve(__dirname, 'src') | ||
} | ||
}, | ||
node: { | ||
fs: 'empty' | ||
}, | ||
entry: { | ||
'main': path.resolve(__dirname, 'src/main.js') | ||
}, | ||
plugins: [ | ||
new HtmlWebpackPlugin({ | ||
inject: true, | ||
// chunks: ['main'], | ||
title: 'Example Aepp', | ||
template: './src/index.html', | ||
filename: distFolder + '/index.html', | ||
// Avoids building twice for dev | ||
alwaysWriteToDisk: true | ||
}), | ||
new HtmlWebpackHarddiskPlugin(), | ||
new CleanWebpackPlugin(), | ||
new VueLoaderPlugin(), | ||
new FaviconsWebpackPlugin({ | ||
logo: path.resolve(__dirname, 'src/assets/logo.svg'), | ||
mode: 'webapp', // optional can be 'webapp' or 'light' - 'webapp' by default | ||
devMode: 'webapp', // optional can be 'webapp' or 'light' - 'light' by default | ||
publicPath: '/', | ||
favicons: { | ||
start_url: '/', | ||
appName: 'Example Aepp', | ||
appDescription: 'Example Description.', | ||
developerName: 'Aeternity Developers', | ||
developerURL: 'https://github.com/kenodressel/aepp-boilerplate', | ||
background: '#ff0d6a', | ||
theme_color: '#ff0d6a', | ||
icons: { | ||
coast: false, | ||
yandex: false, | ||
windows: false | ||
} | ||
} | ||
}) | ||
], | ||
module: { | ||
rules: [ | ||
// this will apply to both plain `.js` files | ||
// AND `<script>` blocks in `.vue` files | ||
{ | ||
test: /\.js$/, | ||
include: [ | ||
path.resolve(__dirname, "src"), | ||
path.resolve(__dirname, "node_modules/@aeternity"), | ||
path.resolve(__dirname, "node_modules/rlp"), | ||
// Contains "const" or "let" | ||
path.resolve(__dirname, "node_modules/base-x"), | ||
], | ||
loader: 'babel-loader' | ||
}, | ||
{ | ||
type: 'javascript/auto', | ||
test: /\.mjs$/, | ||
include: [ | ||
path.resolve(__dirname, "node_modules/@download/blockies") | ||
], | ||
loader: 'babel-loader' | ||
}, | ||
// allows vue compoents in '<template><html><script><style>' syntax | ||
{ | ||
test: /\.vue$/, | ||
loader: 'vue-loader', | ||
options: { | ||
loaders: { | ||
js: 'babel-loader!standard-loader?error=true' | ||
} | ||
// extractCSS: true | ||
// other vue-loader options go here | ||
} | ||
}, | ||
{ | ||
test: /\.scss$/, | ||
use: [ | ||
'vue-style-loader', | ||
'css-loader', // translates CSS into CommonJS | ||
'sass-loader' // compiles Sass to CSS, using Node Sass by default | ||
] | ||
}, | ||
{ | ||
test: /\.aes$/, | ||
use: [ | ||
'raw-loader', | ||
] | ||
}, | ||
{ | ||
test: /\.(woff(2)?|ttf|eot|svg|png)(\?v=\d+\.\d+\.\d+)?$/, | ||
use: [{ | ||
loader: 'file-loader', | ||
options: { | ||
name: '[name].[ext]', | ||
outputPath: './assets/' | ||
} | ||
}] | ||
} | ||
] | ||
} | ||
}; |
This file was deleted.
Oops, something went wrong.
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,43 @@ | ||
const merge = require('webpack-merge'); | ||
const common = require('./webpack.common.js'); | ||
|
||
const path = require('path'); | ||
|
||
module.exports = merge(common, { | ||
mode: 'development', | ||
devtool: 'eval-source-map', | ||
devServer: { | ||
contentBase: path.join(__dirname, 'dist'), | ||
port: 8081, | ||
historyApiFallback: true, | ||
disableHostCheck: true, | ||
host: '0.0.0.0' | ||
}, | ||
|
||
output: { | ||
filename: 'bundle.js?[hash]', | ||
publicPath: '/' | ||
}, | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.css$/, | ||
use: [ | ||
'vue-style-loader', | ||
'css-loader', | ||
{ | ||
loader: 'postcss-loader', | ||
options: { | ||
ident: 'postcss', | ||
plugins: [ | ||
require('postcss-import'), | ||
require('tailwindcss'), | ||
require('autoprefixer'), | ||
] | ||
} | ||
} | ||
] | ||
} | ||
] | ||
} | ||
}); |
Oops, something went wrong.