Fixing building of typings
This commit is contained in:
parent
1cd18db560
commit
285712bfc7
3 changed files with 13 additions and 9 deletions
|
@ -52,6 +52,7 @@
|
|||
"scripts": {
|
||||
"start": "TS_NODE_PROJECT=\"tsconfig-for-webpack.json\" webpack serve --open",
|
||||
"build": "TS_NODE_PROJECT=\"tsconfig-for-webpack.json\" NODE_ENV=production webpack",
|
||||
"build-typings": "TS_NODE_PROJECT=\"tsconfig-for-webpack.json\" NODE_ENV=production NODE_ENV=production BUILD_TYPINGS=1 webpack",
|
||||
"test": "TS_NODE_PROJECT=\"tsconfig-for-jasmine.json\" ts-node node_modules/jasmine/bin/jasmine --config=jasmine.json",
|
||||
"lint": "node_modules/.bin/eslint src/ . --ext .ts",
|
||||
"fix": "node_modules/.bin/eslint --fix src/ . --ext .ts"
|
||||
|
|
|
@ -10,14 +10,18 @@ import NodePolyfillPlugin from 'node-polyfill-webpack-plugin';
|
|||
import {DISPLAY_TERMS_OF_USE} from "./src/Enum/EnvironmentVariable";
|
||||
|
||||
const mode = process.env.NODE_ENV ?? 'development';
|
||||
const buildNpmTypingsForApi = !!process.env.BUILD_TYPINGS;
|
||||
const isProduction = mode === 'production';
|
||||
const isDevelopment = !isProduction;
|
||||
|
||||
let entries: { [key: string]: string; } = {};
|
||||
if (!buildNpmTypingsForApi) {
|
||||
entries.main = './src/index.ts';
|
||||
}
|
||||
entries.iframe_api = './src/iframe_api.ts';
|
||||
|
||||
module.exports = {
|
||||
entry: {
|
||||
'main': './src/index.ts',
|
||||
'iframe_api': './src/iframe_api.ts'
|
||||
},
|
||||
entry: entries,
|
||||
mode: mode,
|
||||
devtool: isDevelopment ? 'inline-source-map' : 'source-map',
|
||||
devServer: {
|
||||
|
@ -40,7 +44,10 @@ module.exports = {
|
|||
exclude: /node_modules/,
|
||||
loader: 'ts-loader',
|
||||
options: {
|
||||
transpileOnly: true,
|
||||
transpileOnly: !buildNpmTypingsForApi,
|
||||
compilerOptions: {
|
||||
declaration: buildNpmTypingsForApi
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue