isoflow/webpack/prod.config.js

59 lines
1.3 KiB
JavaScript
Raw Normal View History

const path = require('path');
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
const webpack = require('webpack');
2023-03-16 21:27:09 +00:00
module.exports = {
mode: 'production',
2023-08-28 20:01:56 +00:00
target: 'web',
entry: {
'index': './src/Isoflow.tsx',
'/standaloneExports': './src/standaloneExports.ts',
},
2023-03-16 21:27:09 +00:00
output: {
path: path.resolve(__dirname, '../dist'),
filename: '[name].js',
libraryTarget: 'commonjs2'
2023-03-16 21:27:09 +00:00
},
externals: {
react: {
commonjs: 'react',
commonjs2: 'react',
amd: 'React',
root: 'React'
2023-03-16 21:27:09 +00:00
},
'react-dom': {
commonjs: 'react-dom',
commonjs2: 'react-dom',
amd: 'ReactDOM',
root: 'ReactDOM'
}
2023-03-16 21:27:09 +00:00
},
module: {
rules: [
{
test: /\.(ts|tsx)$/,
use: 'ts-loader',
exclude: /node_modules/
2023-03-16 21:27:09 +00:00
},
2023-07-12 11:16:52 +00:00
{
test: /\.css$/i,
use: ['style-loader', 'css-loader']
2023-07-12 11:16:52 +00:00
},
{
test: /\.svg$/,
type: 'asset/inline'
}
]
2023-03-16 21:27:09 +00:00
},
plugins: [
new webpack.DefinePlugin({
PACKAGE_VERSION: JSON.stringify(require("../package.json").version),
REPOSITORY_URL: JSON.stringify(require("../package.json").repository.url),
})
],
2023-03-16 21:27:09 +00:00
resolve: {
extensions: ['.tsx', '.ts', '.js'],
plugins: [new TsconfigPathsPlugin()]
}
2023-03-16 21:27:09 +00:00
};