bitwarden-estensione-browser/webpack.main.js

67 lines
1.6 KiB
JavaScript
Raw Normal View History

2018-01-23 19:59:01 +01:00
const path = require('path');
const webpack = require('webpack');
const merge = require('webpack-merge');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const nodeExternals = require('webpack-node-externals');
const common = {
module: {
rules: [
{
test: /\.ts$/,
enforce: 'pre',
loader: 'tslint-loader'
},
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules\/(?!(@bitwarden)\/).*/
},
]
},
plugins: [],
resolve: {
extensions: ['.tsx', '.ts', '.js'],
alias: {
jslib: path.join(__dirname, 'node_modules/@bitwarden/jslib/src')
}
},
output: {
filename: '[name].js',
path: path.resolve(__dirname, 'build')
}
};
const main = {
target: 'electron-main',
node: {
__dirname: false,
__filename: false
},
entry: {
'main': './src/main.ts'
},
module: {
rules: [
{
test: /\.node$/,
loader: 'node-loader'
},
]
},
plugins: [
new CleanWebpackPlugin([
path.resolve(__dirname, 'build/*')
]),
new CopyWebpackPlugin([
2018-02-12 19:21:38 +01:00
'./src/package.json',
2018-01-24 05:38:56 +01:00
{ from: './src/images', to: 'images' },
2018-01-25 02:52:51 +01:00
{ from: './src/locales', to: 'locales' },
2018-01-23 19:59:01 +01:00
]),
],
externals: [nodeExternals()]
};
module.exports = merge(common, main);