lbry-desktop/ui/webpack.config.js

61 lines
1.3 KiB
JavaScript
Raw Normal View History

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