lbry-desktop/webpack.web.config.js

66 lines
1.5 KiB
JavaScript
Raw Normal View History

2019-03-05 05:46:57 +01:00
const path = require('path');
const merge = require('webpack-merge');
const baseConfig = require('./webpack.base.config.js');
const CopyWebpackPlugin = require('copy-webpack-plugin');
2019-03-18 06:06:41 +01:00
const { DefinePlugin } = require('webpack');
2019-03-05 05:46:57 +01:00
const STATIC_ROOT = path.resolve(__dirname, 'static/');
const DIST_ROOT = path.resolve(__dirname, 'dist/');
2019-03-06 18:04:26 +01:00
const WEB_PLATFORM_ROOT = path.resolve(__dirname, 'src/platforms/web/');
2019-03-05 05:46:57 +01:00
const webConfig = {
target: 'web',
entry: {
ui: './src/ui/index.jsx',
2019-03-05 05:46:57 +01:00
},
output: {
2019-03-05 18:54:11 +01:00
filename: '[name].js',
2019-03-05 05:46:57 +01:00
path: __dirname + '/dist/web',
},
module: {
rules: [
{
test: /\.jsx?$/,
use: [
{
loader: 'preprocess-loader',
options: {
TARGET: 'web',
ppOptions: {
type: 'js',
},
},
},
],
},
],
},
resolve: {
modules: [path.resolve(__dirname, 'src/platforms/')],
alias: {
electron: path.resolve(__dirname, 'src/platforms/web/electron'),
},
},
plugins: [
new CopyWebpackPlugin([
{
from: `${STATIC_ROOT}/index.html`,
to: `${DIST_ROOT}/web/index.html`,
},
2019-03-08 20:20:17 +01:00
{
from: `${STATIC_ROOT}/img/favicon.ico`,
to: `${DIST_ROOT}/web/favicon.ico`,
},
2019-03-06 18:04:26 +01:00
{
from: `${WEB_PLATFORM_ROOT}/server.js`,
to: `${DIST_ROOT}/web/server.js`,
},
2019-03-05 05:46:57 +01:00
]),
2019-03-18 06:06:41 +01:00
new DefinePlugin({
IS_WEB: JSON.stringify(true),
}),
2019-03-05 05:46:57 +01:00
],
};
module.exports = merge(baseConfig, webConfig);