Great article, thanks for share. the article does not cover the build of a single file sdk, here are some inputs.
a webpack.config.js file
const path = require('path'); module.exports = { mode: "production", devtool: "inline-source-map", entry: { main: "./index.ts", }, output: { path: path.resolve(__dirname, './dist'), filename: "sdk-file.js", library: 'name-of-the-main-class', libraryTarget: "umd", libraryExport: "default" }, resolve: { extensions: [".ts", ".tsx", ".js"], }, module: { rules: [ { test: /\.tsx?$/, loader: "ts-loader" } ] } };
install ts-loader, webpack-cli and npm script for build build: "webpack"
this work for me and let me build a sdk in a single file.
in the html file dont forget to use
<script type="module"></script>
for include the js file and for the code
getting error: ReferenceError: FormData is not defined when added build to testing app created a package.json file in the dist folder
repo: github.com/labeebshareef/typescrip...
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Great article, thanks for share. the article does not cover the build of a single file sdk, here are some inputs.
a webpack.config.js file
install ts-loader, webpack-cli and npm script for build
build: "webpack"
this work for me and let me build a sdk in a single file.
in the html file dont forget to use
for include the js file and for the code
getting error:
ReferenceError: FormData is not defined
when added build to testing app
created a package.json file in the dist folder
repo: github.com/labeebshareef/typescrip...