-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
try webpack4 + EsmWebpackPlugin for ESM package
- Loading branch information
1 parent
7ad4afb
commit 7ee0430
Showing
7 changed files
with
1,853 additions
and
746 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,31 @@ | ||
const webpack = require('webpack'); | ||
const path = require('path'); | ||
const EsmWebpackPlugin = require("@purtuga/esm-webpack-plugin"); | ||
|
||
module.exports = [ | ||
{ | ||
target: "web", | ||
mode: "production", | ||
output: { | ||
filename: 'index.js', | ||
library: 'CoinbaseWalletSdk', | ||
libraryTarget: 'umd', | ||
path: path.resolve(__dirname, 'dist/umd') | ||
}, | ||
plugins: [ | ||
new webpack.ProvidePlugin({ | ||
Buffer: ['buffer', 'Buffer'], | ||
}), | ||
new webpack.DefinePlugin({ | ||
"process.env": { | ||
NODE_ENV: JSON.stringify("production"), | ||
LINK_API_URL: JSON.stringify("https://www.walletlink.org"), | ||
SDK_VERSION: JSON.stringify("3.0.5") | ||
} | ||
}) | ||
], | ||
const umd = { | ||
output: { | ||
filename: 'index.js', | ||
library: 'CoinbaseWalletSdk', | ||
libraryTarget: 'umd', | ||
path: path.resolve(__dirname, 'dist/umd') | ||
}, | ||
{ | ||
target: "web", | ||
mode: "production", | ||
experiments: { | ||
outputModule: true, | ||
}, | ||
output: { | ||
filename: 'index.js', | ||
libraryTarget: 'module', | ||
path: path.resolve(__dirname, 'dist/esm') | ||
}, | ||
plugins: [ | ||
new webpack.ProvidePlugin({ | ||
Buffer: ['buffer', 'Buffer'], | ||
}), | ||
new webpack.DefinePlugin({ | ||
"process.env": { | ||
NODE_ENV: JSON.stringify("production"), | ||
LINK_API_URL: JSON.stringify("https://www.walletlink.org"), | ||
SDK_VERSION: JSON.stringify("3.0.5") | ||
} | ||
}) | ||
], | ||
node: { | ||
Buffer: true | ||
} | ||
] | ||
} | ||
|
||
const esm = { | ||
output: { | ||
filename: 'index.js', | ||
library: 'CoinbaseWalletSdk', | ||
libraryTarget: 'var', | ||
path: path.resolve(__dirname, 'dist/esm') | ||
}, | ||
plugins: [ | ||
new EsmWebpackPlugin() | ||
], | ||
node: { | ||
Buffer: true | ||
} | ||
} | ||
|
||
module.exports = [umd, esm] |
Oops, something went wrong.