mirror of
https://github.com/iden3/js-iden3-core.git
synced 2026-01-10 06:18:02 -05:00
esm module build fix
This commit is contained in:
@@ -6,16 +6,18 @@
|
||||
".": {
|
||||
"import": {
|
||||
"types": "./dist/esm/types/index.d.ts",
|
||||
"default": "./dist/esm/index.mjs"
|
||||
"module": "./dist/esm/index.js",
|
||||
"default": "./dist/esm/index.js"
|
||||
},
|
||||
"require": {
|
||||
"types": "./dist/cjs/types/index.d.ts",
|
||||
"module": "./dist/cjs/index.js",
|
||||
"default": "./dist/cjs/index.js"
|
||||
}
|
||||
}
|
||||
},
|
||||
"types": "./dist/cjs/types/index.d.ts",
|
||||
"main": "./dist/cjs/index.js",
|
||||
"main": "index.js",
|
||||
"module": "./dist/esm/index.mjs",
|
||||
"source": "./src/index.ts",
|
||||
"files": [
|
||||
@@ -23,7 +25,7 @@
|
||||
],
|
||||
"scripts": {
|
||||
"clean": "rimraf ./dist",
|
||||
"build": "npm run clean && tsc -p configs/tsconfig.cjs.json && tsc -p configs/tsconfig.esm.json && webpack --mode production",
|
||||
"build": "npm run clean && tsc -p configs/tsconfig.cjs.json && webpack --config webpack.esm.config.js --mode=production && webpack --mode production",
|
||||
"test:coverage": "jest --coverage",
|
||||
"test": "jest",
|
||||
"test:watch": "jest --watch",
|
||||
|
||||
54
webpack.esm.config.js
Normal file
54
webpack.esm.config.js
Normal file
@@ -0,0 +1,54 @@
|
||||
const path = require('path');
|
||||
const webpack = require('webpack');
|
||||
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
|
||||
const { merge } = require('webpack-merge');
|
||||
|
||||
const prodConfig = require('./webpack.prod');
|
||||
module.exports = function () {
|
||||
const config = {
|
||||
mode: "production",
|
||||
// devtool: 'source-map',
|
||||
entry: './src/index.ts',
|
||||
experiments: {
|
||||
outputModule: true
|
||||
},
|
||||
output: {
|
||||
filename: 'index.js',
|
||||
path: path.resolve(__dirname, 'dist/esm'),
|
||||
library: {
|
||||
type: "commonjs2",
|
||||
}
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.tsx?$/,
|
||||
exclude: /(node_modules|bower_components)/,
|
||||
loader: 'ts-loader'
|
||||
}
|
||||
]
|
||||
},
|
||||
plugins: [
|
||||
new webpack.ProgressPlugin(),
|
||||
new CleanWebpackPlugin(),
|
||||
new webpack.ProvidePlugin({
|
||||
Buffer: ['buffer', 'Buffer'],
|
||||
}),
|
||||
new webpack.ProvidePlugin({
|
||||
process: 'process/browser',
|
||||
})
|
||||
],
|
||||
resolve: {
|
||||
extensions: ['.tsx', '.ts', '.js'],
|
||||
fallback: {
|
||||
assert: require.resolve('assert'),
|
||||
crypto: require.resolve('crypto-browserify'),
|
||||
os: require.resolve('os-browserify/browser'),
|
||||
stream: require.resolve('stream-browserify'),
|
||||
process: require.resolve('process/browser'),
|
||||
buffer: require.resolve('buffer')
|
||||
}
|
||||
}
|
||||
}
|
||||
return merge(config, prodConfig);
|
||||
};
|
||||
Reference in New Issue
Block a user