lbry-desktop/ui/webpack.config.js

61 lines
1.3 KiB
JavaScript
Raw Normal View History

2017-06-11 06:59:33 +02:00
const path = require("path");
const webpack = require("webpack")
const appPath = path.resolve(__dirname, "js");
2016-11-22 21:19:08 +01:00
2017-08-16 05:02:16 +02:00
process.traceDeprecation = true;
2016-11-22 21:19:08 +01:00
const PATHS = {
2017-06-11 06:59:33 +02:00
app: path.join(__dirname, "app"),
dist: path.join(__dirname, "dist")
2016-11-22 21:19:08 +01:00
};
module.exports = {
2017-06-11 06:59:33 +02:00
entry: ["babel-polyfill", "./js/main.js"],
2016-11-22 21:19:08 +01:00
output: {
2017-06-11 06:59:33 +02:00
path: path.join(PATHS.dist, "js"),
publicPath: "/js/",
2016-11-22 21:19:08 +01:00
filename: "bundle.js"
},
2017-06-11 06:59:33 +02:00
devtool: "source-map",
2017-04-07 07:15:22 +02:00
resolve: {
2017-06-10 07:13:11 +02:00
modules: [appPath, "node_modules"],
2017-06-11 06:59:33 +02:00
extensions: [".js", ".jsx", ".css"]
2017-04-07 07:15:22 +02:00
},
plugins: [
new webpack.DefinePlugin({
ENV: JSON.stringify("production"),
}),
],
2016-11-22 21:19:08 +01:00
module: {
2017-06-10 07:13:11 +02:00
rules: [
2016-11-22 21:19:08 +01:00
{
test: /\.jsx?$/,
2017-06-10 07:13:11 +02:00
enforce: "pre",
2017-06-11 06:59:33 +02:00
loaders: ["eslint"],
2016-11-22 21:19:08 +01:00
// define an include so we check just the files we need
include: PATHS.app
2017-05-25 19:40:46 +02:00
},
{
test: /\.node$/,
use: ["node-loader"]
},
2017-05-25 19:40:46 +02:00
{
2017-06-10 07:13:11 +02:00
test: /\.css$/,
use: ["style-loader", "css-loader"]
2017-05-25 19:40:46 +02:00
},
2017-06-10 07:13:11 +02:00
{
test: /\.jsx?$/,
exclude: /node_modules/,
use: {
2017-06-11 06:59:33 +02:00
loader: "babel-loader",
2017-06-10 07:13:11 +02:00
options: {
cacheDirectory: true,
2017-06-11 06:59:33 +02:00
presets: [ "es2015", "react", "stage-2" ]
2017-06-10 07:13:11 +02:00
}
}
}
2016-11-22 21:19:08 +01:00
]
2017-01-19 10:50:08 +01:00
},
2017-06-11 06:59:33 +02:00
target: "electron-main",
2017-06-10 07:03:02 +02:00
};