mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-05-16 21:00:14 +00:00
* working on re-organizing js code for ortweb * remove dup files * move folder * fix common references * fix common es5 * add webpack to common * split interfact/impl * use cjs for node * add npmignore for common * update sourcemap config for common * update node * adjust folder/path in CI and build * update folder * nit: readme * add bundle for dev * correct nodejs paths * enable ORT_API_MANUAL_INIT * set name for umd library * correct name for commonjs export * add priority into registerBackend() * fix npm ci pwd * update eslintrc * revise code * revert package-lock lockfileVersion 2->1 * update prebuild * resolve comments * update document * revise eslint config * update eslint for typescript rules * revert changes by mistake in backend.ts * add env * resolve comments
47 lines
1.1 KiB
JavaScript
47 lines
1.1 KiB
JavaScript
const path = require('path');
|
|
const webpack = require('webpack');
|
|
|
|
function buildConfig({
|
|
suffix = '',
|
|
format = 'umd',
|
|
target = 'ES2017',
|
|
mode = 'production',
|
|
devtool = 'source-map'
|
|
}) {
|
|
return {
|
|
entry: path.resolve(__dirname, 'lib/index.ts'),
|
|
output: {
|
|
path: path.resolve(__dirname, 'dist'),
|
|
filename: `ort-common${suffix}.js`,
|
|
library: {
|
|
name: format === 'commonjs' ? undefined : 'ort',
|
|
type: format
|
|
}
|
|
},
|
|
resolve: { extensions: ['.ts', '.js'] },
|
|
plugins: [new webpack.WatchIgnorePlugin({ paths: [/\.js$/, /\.d\.ts$/] })],
|
|
module: {
|
|
rules: [{
|
|
test: /\.tsx?$/,
|
|
use: [
|
|
{
|
|
loader: 'ts-loader',
|
|
options: {
|
|
compilerOptions: { target: target }
|
|
}
|
|
}
|
|
]
|
|
}]
|
|
},
|
|
mode: mode,
|
|
devtool: devtool,
|
|
};
|
|
}
|
|
|
|
module.exports = (env, argv) => {
|
|
return [
|
|
buildConfig({ format: 'umd', mode: 'development', devtool: 'inline-source-map', target: 'es5' }),
|
|
buildConfig({ format: 'umd', suffix: '.min', target: 'es5' }),
|
|
buildConfig({ format: 'commonjs', suffix: '.node', target: 'es5' }),
|
|
];
|
|
};
|