2019-12-29 22:31:32 +00:00
|
|
|
import path from 'path';
|
2019-11-24 22:44:26 +00:00
|
|
|
|
2019-12-29 22:31:32 +00:00
|
|
|
import webpack from 'webpack';
|
2019-11-24 22:44:26 +00:00
|
|
|
|
|
|
|
|
const diff2htmlBrowserConfig: webpack.Configuration = {
|
|
|
|
|
module: {
|
|
|
|
|
rules: [
|
|
|
|
|
{
|
|
|
|
|
test: /\.tsx?$/,
|
2019-12-29 22:31:32 +00:00
|
|
|
use: 'ts-loader',
|
|
|
|
|
exclude: /node_modules/,
|
|
|
|
|
},
|
|
|
|
|
],
|
2019-11-24 22:44:26 +00:00
|
|
|
},
|
|
|
|
|
resolve: {
|
2019-12-29 22:31:32 +00:00
|
|
|
extensions: ['.tsx', '.ts', '.jsx', '.js'],
|
2019-11-24 22:44:26 +00:00
|
|
|
},
|
2019-12-29 22:31:32 +00:00
|
|
|
entry: './src/diff2html.ts',
|
2019-11-24 22:44:26 +00:00
|
|
|
output: {
|
2019-12-29 22:31:32 +00:00
|
|
|
path: path.resolve(__dirname, 'bundles/js'),
|
|
|
|
|
libraryTarget: 'umd',
|
|
|
|
|
globalObject: 'this',
|
|
|
|
|
library: 'Diff2Html',
|
|
|
|
|
filename: 'diff2html.min.js',
|
|
|
|
|
umdNamedDefine: true,
|
2019-11-24 22:44:26 +00:00
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
|
2019-12-29 22:31:32 +00:00
|
|
|
function diff2htmlUIBrowserConfig(entrypointName: string): webpack.Configuration {
|
|
|
|
|
return {
|
|
|
|
|
module: {
|
|
|
|
|
rules: [
|
|
|
|
|
{
|
|
|
|
|
test: /\.tsx?$/,
|
|
|
|
|
use: 'ts-loader',
|
|
|
|
|
exclude: /node_modules/,
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
resolve: {
|
|
|
|
|
extensions: ['.tsx', '.ts', '.jsx', '.js'],
|
|
|
|
|
},
|
|
|
|
|
entry: `./src/ui/js/${entrypointName}.ts`,
|
|
|
|
|
output: {
|
|
|
|
|
path: path.resolve(__dirname, 'bundles/js'),
|
|
|
|
|
libraryTarget: 'umd',
|
|
|
|
|
globalObject: 'this',
|
|
|
|
|
filename: `${entrypointName}.min.js`,
|
|
|
|
|
umdNamedDefine: true,
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const config: webpack.Configuration[] = [
|
|
|
|
|
diff2htmlBrowserConfig,
|
|
|
|
|
diff2htmlUIBrowserConfig('diff2html-ui'),
|
|
|
|
|
diff2htmlUIBrowserConfig('diff2html-ui-slim'),
|
|
|
|
|
diff2htmlUIBrowserConfig('diff2html-ui-base'),
|
|
|
|
|
];
|
2019-11-24 22:44:26 +00:00
|
|
|
|
|
|
|
|
export default config;
|