lbry-desktop/webpack.web.config.js

67 lines
1.5 KiB
JavaScript
Raw Normal View History

2019-03-04 23:46:57 -05: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 01:06:41 -04:00
const { DefinePlugin } = require('webpack');
2019-03-04 23:46:57 -05:00
const STATIC_ROOT = path.resolve(__dirname, 'static/');
const DIST_ROOT = path.resolve(__dirname, 'dist/');
2019-03-06 12:04:26 -05:00
const WEB_PLATFORM_ROOT = path.resolve(__dirname, 'src/platforms/web/');
2019-03-04 23:46:57 -05:00
const webConfig = {
target: 'web',
entry: {
ui: './src/ui/index.jsx',
2019-03-04 23:46:57 -05:00
},
output: {
2019-03-05 12:54:11 -05:00
filename: '[name].js',
2019-03-04 23:46:57 -05:00
path: __dirname + '/dist/web',
2019-04-01 12:11:20 -04:00
publicPath: '/',
2019-03-04 23:46:57 -05:00
},
module: {
rules: [
{
2019-03-29 10:23:32 -04:00
test: /\.(jsx?$|s?css$)/,
2019-03-04 23:46:57 -05:00
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 14:20:17 -05:00
{
from: `${STATIC_ROOT}/img/favicon.ico`,
to: `${DIST_ROOT}/web/favicon.ico`,
},
2019-03-06 12:04:26 -05:00
{
from: `${WEB_PLATFORM_ROOT}/server.js`,
to: `${DIST_ROOT}/web/server.js`,
},
2019-03-04 23:46:57 -05:00
]),
2019-03-18 01:06:41 -04:00
new DefinePlugin({
IS_WEB: JSON.stringify(true),
}),
2019-03-04 23:46:57 -05:00
],
};
module.exports = merge(baseConfig, webConfig);