lbry-desktop/ui/webpack.config.js

55 lines
1.2 KiB
JavaScript
Raw Normal View History

2016-11-22 14:19:08 -06:00
const path = require('path');
const webpack = require('webpack')
2017-04-07 12:15:22 +07:00
const appPath = path.resolve(__dirname, 'js');
2016-11-22 14:19:08 -06:00
const PATHS = {
app: path.join(__dirname, 'app'),
dist: path.join(__dirname, 'dist')
};
module.exports = {
entry: ['babel-polyfill', './js/main.js'],
2016-11-22 14:19:08 -06:00
output: {
2017-01-26 11:40:44 -06:00
path: path.join(PATHS.dist, 'js'),
publicPath: '/js/',
2016-11-22 14:19:08 -06:00
filename: "bundle.js"
},
devtool: 'source-map',
2017-04-07 12:15:22 +07:00
resolve: {
2017-06-09 22:13:11 -07:00
modules: [appPath, "node_modules"],
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",
2016-11-22 14:19:08 -06:00
loaders: ['eslint'],
// define an include so we check just the files we need
include: PATHS.app
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: {
loader: 'babel-loader',
options: {
cacheDirectory: true,
presets: [ 'es2015', 'react', 'stage-2' ]
}
}
}
2016-11-22 14:19:08 -06:00
]
2017-01-19 03:50:08 -06:00
},
target: 'electron-main',
2017-06-09 22:03:02 -07:00
};