| const path = require('path'); |
| const { CleanWebpackPlugin } = require('clean-webpack-plugin'); |
| const HtmlWebpackPlugin = require('html-webpack-plugin'); |
| |
| |
| module.exports = { |
| entry: './src/index.ts', |
| module: { |
| rules: [ |
| { |
| test: /\.tsx?$/, |
| use: 'ts-loader', |
| exclude: /node_modules/, |
| }, |
| { |
| test: /\.jsx?$/, |
| include: [ |
| path.resolve(__dirname, "node_modules/casbin/lib/esm"), |
| ], |
| use: { |
| loader: 'babel-loader', |
| options: { |
| presets: ['@babel/preset-env'], |
| plugins: ['@babel/plugin-proposal-optional-chaining'] |
| }, |
| }, |
| } |
| ], |
| }, |
| resolve: { |
| extensions: [ '.tsx', '.ts', '.js' ], |
| fallback: { |
| fs: false |
| } |
| }, |
| |
| output: { |
| library: 'casbin', |
| libraryTarget: 'umd', |
| filename: 'casbin.js', |
| path: path.resolve(__dirname, 'dist'), |
| }, |
| plugins: [ |
| new CleanWebpackPlugin() |
| ] |
| }; |