Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
/*---------------------------------------------------------------------------------------------
* Copyright (c) 2019 Bentley Systems, Incorporated. All rights reserved.
* Licensed under the MIT License. See LICENSE.md in the project root for license terms.
*--------------------------------------------------------------------------------------------*/
const path = require("path");
const webpack = require("webpack");
const configLoader = require("@bentley/config-loader/lib/IModelJsConfig")
const configEnv = configLoader.IModelJsConfig.init(true /*suppress error*/, true /* suppress message */);
if (configEnv) {
Object.assign(process.env, configEnv);
} else {
console.error("Webpack failed to locate iModelJs configuration");
}
const raw = process.env;
module.exports = {
mode: "development",
entry: "./lib/frontend/DisplayPerformanceTestApp.js",
output: {
path: path.resolve(__dirname, "./lib/webresources"),
filename: '[name].bundle.js',
devtoolModuleFilenameTemplate: "file:///[absolute-resource-path]"
},
/*---------------------------------------------------------------------------------------------
* Copyright (c) 2019 Bentley Systems, Incorporated. All rights reserved.
* Licensed under the MIT License. See LICENSE.md in the project root for license terms.
*--------------------------------------------------------------------------------------------*/
const path = require("path");
const glob = require("glob");
const webpack = require("webpack");
const raw = require("@bentley/config-loader/lib/IModelJsConfig").IModelJsConfig.init(true /*suppress error*/, true);
module.exports = {
mode: "development",
entry: glob.sync(path.resolve(__dirname, "lib/**/*.test.js")),
output: {
path: path.resolve(__dirname, "lib/dist"),
filename: "bundled-tests.js",
devtoolModuleFilenameTemplate: "file:///[absolute-resource-path]"
},
devtool: "nosources-source-map",
module: {
noParse: [
// Don't parse draco_*_nodejs.js modules for `require` calls. There are
// requires for fs that cause it to fail even though the fs dependency
// is not used.
/draco_decoder_nodejs.js$/,
/draco_encoder_nodejs.js$/
/*---------------------------------------------------------------------------------------------
* Copyright (c) 2019 Bentley Systems, Incorporated. All rights reserved.
* Licensed under the MIT License. See LICENSE.md in the project root for license terms.
*--------------------------------------------------------------------------------------------*/
const path = require("path");
const glob = require("glob");
const webpack = require("webpack");
const raw = require("@bentley/config-loader/lib/IModelJsConfig").IModelJsConfig.init(true /*suppress error*/, true);
function createConfig(shouldInstrument) {
const config = {
mode: "development",
entry: glob.sync(path.resolve(__dirname, "lib/**/*.test.js")),
output: {
path: path.resolve(__dirname, "lib/dist"),
filename: "bundled-tests.js",
devtoolModuleFilenameTemplate: "file:///[absolute-resource-path]"
},
devtool: "nosources-source-map",
module: {
noParse: [
// Don't parse draco_*_nodejs.js modules for `require` calls. There are
// requires for fs that cause it to fail even though the fs dependency
// is not used.
/*---------------------------------------------------------------------------------------------
* Copyright (c) 2019 Bentley Systems, Incorporated. All rights reserved.
* Licensed under the MIT License. See LICENSE.md in the project root for license terms.
*--------------------------------------------------------------------------------------------*/
"use strict";
const fs = require("fs");
const path = require("path");
const paths = require("./paths");
// Load iModelJS configuration
if (process.env.IMODELJS_USE_CONFIG_LOADER && process.env.IMODELJS_USE_CONFIG_LOADER.toLowerCase() === "yes") {
const configLoader = require("@bentley/config-loader/lib/IModelJsConfig");
const configEnv = configLoader.IModelJsConfig.init(false /*suppress error*/);
if (configEnv && process.env) {
Object.assign(process.env, configEnv);
} else {
console.log("Webpack failed to locate iModelJs configuration");
}
}
// Make sure that including paths.js after env.js will read .env variables.
delete require.cache[require.resolve("./paths")];
const NODE_ENV = process.env.NODE_ENV;
if (!NODE_ENV) {
throw new Error(
"The NODE_ENV environment variable is required but was not specified."
);
}