1
0
mirror of https://github.com/byulmaru/quesdon synced 2024-12-01 00:08:05 +09:00
quesdon/webpack.config.js

43 lines
1.2 KiB
JavaScript
Raw Normal View History

2017-12-09 09:39:59 +09:00
const webpack = require("webpack")
2018-01-20 19:12:24 +09:00
const UglifyJsPlugin = require("uglifyjs-webpack-plugin")
2018-01-20 19:32:57 +09:00
const isProduction = process.env.NODE_ENV == "production"
2017-12-09 09:39:59 +09:00
module.exports = {
entry: "./src/client/index.ts",
output: {
path: __dirname+"/dist/client",
filename: "bundle.js",
publicPath: "/assets/",
},
devServer: {
contentBase: "dist/client",
proxy: {
"/": "http://localhost:"+(process.env.BACK_PORT || 3000)
},
},
plugins: [
new webpack.ProvidePlugin({
riot: "riot",
"$": "jquery",
apiFetch: __dirname+"/src/client/api-fetch.ts"
2018-01-20 19:02:33 +09:00
}),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV)
2017-12-09 09:39:59 +09:00
})
],
module: {
loaders: [
{test: /\.css$/, loader: 'style-loader!css-loader'},
{test: /\.(woff2?|ttf|eot|svg)$/, loader: 'file-loader'},
2018-01-20 19:32:57 +09:00
{test: /\.tsx?$/, loader: isProduction ? 'babel-loader!ts-loader' : 'ts-loader'},
2017-12-09 09:39:59 +09:00
]
2018-01-19 03:31:13 +09:00
},
resolve: {
extensions: [".ts", ".tsx", ".js"]
2017-12-09 09:39:59 +09:00
}
2018-01-20 19:12:24 +09:00
}
if (process.env.NODE_ENV == "production") {
module.exports.plugins.push(new UglifyJsPlugin({
}))
2017-12-09 09:39:59 +09:00
}