receptor/webpack.config.js

67 lines
1.7 KiB
JavaScript
Raw Permalink Normal View History

2017-08-07 00:23:54 +02:00
const path = require("path");
const webpack = require("webpack");
const defines = {
"DEFAULT_WS_URI": process.env.WEBSOCKET_URI || "ws://127.0.0.1:8412/"
2017-08-07 00:23:54 +02:00
};
const env = process.env.ENVIRONMENT || "development";
2017-08-07 00:23:54 +02:00
module.exports = {
devtool: "source-map",
entry: [
2018-03-04 02:51:10 +01:00
(env !== "production" && "react-hot-loader/patch"),
(env !== "production" && "webpack-hot-middleware/client"),
2017-08-24 15:50:14 +02:00
"font-awesome-sass-loader!./font-awesome.config.js",
2017-08-07 00:23:54 +02:00
"./src/index.js"
2018-03-04 02:51:10 +01:00
].filter(f => f),
2017-08-07 00:23:54 +02:00
output: {
filename: "bundle.js",
path: path.resolve(__dirname, "dist"),
publicPath: "/dist/"
},
module: {
rules: [
{ test: /\.js$/, exclude: /node_modules/, loader: "babel-loader" },
2017-08-24 15:50:14 +02:00
{ test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/, use: [
{
loader: 'url-loader',
options: { limit: 10000, mimetype: 'application/font-woff' },
}
]
},
{
test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
use: [ { loader: 'file-loader' } ]
},
2017-08-07 00:23:54 +02:00
{ test: /\.scss$/,
use: [
'style-loader',
'css-loader',
{
loader: 'sass-loader',
options: {
includePaths: [
2017-08-22 21:49:48 +02:00
path.resolve(__dirname, './node_modules'),
path.resolve(__dirname, './scss/srht/srht/scss'),
2017-08-07 00:23:54 +02:00
]
2017-08-22 21:49:48 +02:00
},
2017-08-07 00:23:54 +02:00
}
],
}
]
},
plugins:[
(env !== "production" && new webpack.HotModuleReplacementPlugin()),
new webpack.EnvironmentPlugin(defines),
new webpack.NamedModulesPlugin(),
].filter(p => p),
2017-08-25 01:11:40 +02:00
resolve: {
alias: {
"react": "preact-compat",
"react-dom": "preact-compat",
"preact-compat": "preact-compat/dist/preact-compat"
2017-08-25 01:11:40 +02:00
}
}
2017-08-07 00:23:54 +02:00
};