Skip to content

Instantly share code, notes, and snippets.

@yaakaito
Created October 1, 2019 19:13
Show Gist options
  • Save yaakaito/a49bd506e49c644c3d5d3baefc7ac839 to your computer and use it in GitHub Desktop.
Save yaakaito/a49bd506e49c644c3d5d3baefc7ac839 to your computer and use it in GitHub Desktop.
適当にデモ用の最小構成
const path = require('path')
const HtmlWebpackPlugin = require('html-webpack-plugin')
module.exports = (env = {}) => {
return {
mode: 'development',
entry: {
index: path.resolve(__dirname, 'src/index.ts')
},
output: {
filename: '[name]-[contenthash].js',
path: path.resolve(__dirname, 'dist'),
},
plugins: [
new HtmlWebpackPlugin({
chunks: ['index'],
filename: 'index.html',
template: path.resolve(__dirname, 'src/index.html')
})
],
devServer: {
contentBase: path.resolve(__dirname, './dist'),
port: 9000,
},
resolve: {
extensions: ['.js', '.ts'],
modules: [
"node_modules"
]
},
module: {
rules: [
{
test: /\.ts$/,
use: [
{
loader: 'ts-loader',
options: {
appendTsSuffixTo: [/\.vue$/],
},
},
],
exclude: /node_modules/,
},
]
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment