Initial boilerplate setup
This commit is contained in:
1 parent
739aca9495
commit
8ee9e8a838
17 files changed
+29239
No files matched your search
@@ -0,0 +1,54 @@
|
||||
const webpack = require('webpack')
|
||||
const Dotenv = require('dotenv-webpack')
|
||||
const path = require('path')
|
||||
const merge = require('webpack-merge')
|
||||
const history = require('connect-history-api-fallback')
|
||||
const convert = require('koa-connect')
|
||||
const commonConfig = require('./helpers/webpack.common.config')
|
||||
const HtmlWebpackPlugin = require('html-webpack-plugin')
|
||||
const HtmlWebpackHarddiskPlugin = require('html-webpack-harddisk-plugin')
|
||||
const ScriptExtHtmlWebpackPlugin = require('script-ext-html-webpack-plugin')
|
||||
|
||||
module.exports = merge(commonConfig, {
|
||||
mode: 'development',
|
||||
devtool: 'inline-sourcemap',
|
||||
|
||||
output: {
|
||||
path: path.resolve(__dirname, '../../build'),
|
||||
filename: 'script.js'
|
||||
},
|
||||
|
||||
plugins: [
|
||||
new Dotenv({
|
||||
path: '.env'
|
||||
}),
|
||||
new webpack.NamedModulesPlugin(),
|
||||
new HtmlWebpackPlugin({
|
||||
template: 'html/index.html',
|
||||
alwaysWriteToDisk: true
|
||||
}),
|
||||
new ScriptExtHtmlWebpackPlugin({
|
||||
defaultAttribute: 'async'
|
||||
}),
|
||||
new HtmlWebpackHarddiskPlugin()
|
||||
],
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.s?[ac]ss$/,
|
||||
loader: 'style-loader!css-loader!postcss-loader!sass-loader'
|
||||
}
|
||||
]
|
||||
},
|
||||
target: 'web'
|
||||
})
|
||||
|
||||
module.exports.serve = {
|
||||
hot: {
|
||||
port: 4536
|
||||
},
|
||||
host: 'localhost',
|
||||
add: (app, middleware, options) => {
|
||||
app.use(convert(history()))
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user