mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-05-17 21:10:43 +00:00
* add web * add script and test * fix lint * add test/data/ops * add test/data/node/ to gitignore * modify scripts * add onnxjs * fix tests * fix test-runner * fix sourcemap * fix onnxjs profiling * update test list * update README * resolve comments * set wasm as default backend * rename package * update copyright header * do not use class "Buffer" in browser context * revise readme
49 lines
1.3 KiB
JavaScript
49 lines
1.3 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({ suffix: '.es6', mode: 'development', devtool: 'inline-source-map', target: 'es6' }),
|
|
buildConfig({ mode: 'development', devtool: 'inline-source-map', target: 'es5' }),
|
|
buildConfig({ suffix: '.es6.min', target: 'es6' }),
|
|
buildConfig({ suffix: '.min', target: 'es5' }),
|
|
buildConfig({ format: 'commonjs', suffix: '.node', target: 'es5' }),
|
|
];
|
|
};
|