diawi-nodejs-uploader/webpack.config.js

42 lines
1.0 KiB
JavaScript
Raw Normal View History

2020-09-24 11:18:42 +00:00
const path = require('path');
const nodeExternals = require('webpack-node-externals');
2020-09-24 12:23:44 +00:00
const DeclarationBundlerPlugin = require('declaration-bundler-webpack-plugin');
2020-09-24 11:18:42 +00:00
const webpack = require('webpack');
2020-09-24 12:23:44 +00:00
const distPath = path.resolve(__dirname, './dist');
2020-09-24 11:18:42 +00:00
module.exports = {
entry: {
core: './src/core/index.ts',
},
output: {
filename: '[name]/index.js',
2020-09-24 12:23:44 +00:00
path: distPath,
2020-09-24 11:18:42 +00:00
},
2020-09-24 12:23:44 +00:00
mode: 'production',
2020-09-24 11:18:42 +00:00
externals: [nodeExternals()],
module: {
rules: [
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/,
},
],
},
target: 'node',
resolve: {
alias: {
'@app': path.resolve(__dirname, './src'),
},
extensions: ['.ts', '.js'],
},
plugins: [
2020-09-24 12:23:44 +00:00
new DeclarationBundlerPlugin({
moduleName: '[name]',
out: path.resolve(distPath, '[name]'),
}),
// new webpack.BannerPlugin({ banner: '#!/usr/bin/env node', raw: true }),
2020-09-24 11:18:42 +00:00
],
};