Tone.js/scripts/webpack.config.cjs
Yotam Mann aaf880c925
Using web-test-runner for tests, updating import paths (#1242)
* WIP moving tests to web-test-runner

* updating thresholds

* Adding file extensions

* Testing integrations

* linting

* fixing dep

* moving back to root dir

* prettier all of the files

* updating eslint rules to use with prettier

* remove import package

* moving tsignore around

* removing unneeded ignores

* all tests run on puppeteer, no need for testing guards

* linting

* import type syntax

* cleaning up

* Update package.json
2024-05-03 14:31:14 -04:00

55 lines
1 KiB
JavaScript

/* eslint-disable @typescript-eslint/no-var-requires */
const path = require("path");
// /////////////////////////////////////
// Defaults
// /////////////////////////////////////
const defaults = {
mode: "development",
context: __dirname,
entry: {
Tone: "../Tone/index.ts",
},
output: {
path: path.resolve(__dirname, "../build"),
filename: "[name].js",
library: "Tone",
libraryTarget: "umd",
globalObject: "typeof self !== 'undefined' ? self : this",
},
resolve: {
extensionAlias: {
".js": [".js", ".ts"],
},
},
module: {
rules: [
{
test: /\.ts$/,
use: "ts-loader",
exclude: /(node_modules)/,
},
],
},
devtool: "cheap-source-map",
};
// /////////////////////////////////////
// Production
// /////////////////////////////////////
const production = Object.assign({}, defaults, {
mode: "production",
devtool: "source-map",
});
module.exports = (env) => {
if (env.test) {
return test;
} else if (env.production) {
return production;
} else {
return scratch;
}
};