Created
January 20, 2017 09:30
-
-
Save takahiro-saeki/9b24d2c6730c81cc0787eb7feff65ab0 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
const webpack = require('webpack'); | |
const HtmlWebpackPlugin = require('html-webpack-plugin'); | |
const path = require('path'); | |
module.exports = { | |
entry: [ | |
'./index.js', | |
'./ejs/index.ejs', | |
'./ejs/detail.ejs' | |
], | |
output: { | |
filename: 'app.bundle.js', | |
path: path.resolve(__dirname, 'dist'), | |
publicPath: './' | |
}, | |
context: path.resolve(__dirname, 'src'), | |
performance: { | |
hints: false | |
}, | |
module: { | |
rules: [ | |
{ | |
test: /\.js$/, | |
exclude: /node_modules/, | |
loader: 'babel-loader' | |
}, | |
{ | |
test: /\.css$/, | |
use: [ | |
'style-loader', | |
'css-loader', | |
{ | |
loader: 'postcss-loader', | |
options: { | |
ident: 'postcss', | |
plugins: () => { | |
return [ | |
require('precss'), | |
require('autoprefixer'), | |
require('postcss-size') | |
]; | |
} | |
} | |
} | |
], | |
}, | |
{ | |
test: /\.ejs$/, | |
loader: 'ejs-compiled-loader' | |
} | |
], | |
}, | |
devServer: { | |
hot: true, | |
inline: true, | |
contentBase: path.resolve(__dirname, 'dist'), | |
publicPath: '/', | |
historyApiFallback: true, | |
open: true | |
}, | |
plugins: [ | |
new HtmlWebpackPlugin({ | |
title: 'webpack2 example', | |
template: path.join(__dirname, './src/ejs/index.ejs') | |
}), | |
new HtmlWebpackPlugin({ | |
title: 'webpack2 example/ detail', | |
template: path.join(__dirname, './src/ejs/detail.ejs'), | |
filename: 'detail.html' | |
}), | |
new webpack.HotModuleReplacementPlugin() | |
], | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment