lbry-desktop/ui/webpack.dev.config.js

67 lines
1.4 KiB
JavaScript
Raw Normal View History

2017-06-11 06:59:33 +02:00
const path = require("path");
const webpack = require("webpack")
const WebpackNotifierPlugin = require("webpack-notifier")
2017-05-05 06:28:30 +02:00
2017-06-11 06:59:33 +02:00
const appPath = path.resolve(__dirname, "js");
const PATHS = {
2017-06-11 06:59:33 +02:00
app: path.join(__dirname, "app"),
dist: path.join(__dirname, "..", "app", "dist")
};
module.exports = {
2017-06-11 06:59:33 +02:00
entry: ["babel-polyfill", "./js/main.js"],
output: {
2017-06-11 06:59:33 +02:00
path: path.join(PATHS.dist, "js"),
publicPath: "/js/",
filename: "bundle.js",
pathinfo: true
},
cache: true,
2017-06-11 06:59:33 +02:00
devtool: "eval",
2017-04-07 07:15:22 +02:00
resolve: {
2017-06-10 07:03:02 +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
},
2017-05-05 06:28:30 +02:00
plugins: [
new WebpackNotifierPlugin(),
new webpack.DefinePlugin({
ENV: JSON.stringify("development"),
}),
2017-06-10 07:03:02 +02:00
new webpack.LoaderOptionsPlugin({
debug: true
})
2017-05-05 06:28:30 +02:00
],
module: {
2017-06-10 07:03:02 +02:00
rules: [
{
test: /\.jsx?$/,
2017-06-10 07:03:02 +02:00
enforce: "pre",
2017-06-11 06:59:33 +02:00
loaders: ["eslint"],
// 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:03:02 +02:00
test: /\.css$/,
use: ["style-loader", "css-loader"]
2017-05-25 19:40:46 +02:00
},
2017-06-10 07:03:02 +02:00
{
test: /\.jsx?$/,
exclude: /node_modules/,
use: {
2017-06-11 06:59:33 +02:00
loader: "babel-loader",
2017-06-10 07:03:02 +02:00
options: {
cacheDirectory: true,
2017-06-11 06:59:33 +02:00
presets: [ "es2015", "react", "stage-2" ]
2017-06-10 07:03:02 +02:00
}
}
}
]
},
2017-06-11 06:59:33 +02:00
target: "electron-main",
2017-06-10 07:03:02 +02:00
};