2019-11-07 20:45:00 +00:00
|
|
|
/* eslint-disable @typescript-eslint/no-var-requires */
|
2018-05-18 16:10:52 +00:00
|
|
|
const path = require("path");
|
|
|
|
|
2019-09-16 18:03:52 +00:00
|
|
|
// /////////////////////////////////////
|
2018-05-18 16:10:52 +00:00
|
|
|
// Defaults
|
2019-09-16 18:03:52 +00:00
|
|
|
// /////////////////////////////////////
|
2018-05-18 16:10:52 +00:00
|
|
|
|
|
|
|
const defaults = {
|
2019-09-16 18:03:52 +00:00
|
|
|
mode: "development",
|
|
|
|
context: __dirname,
|
|
|
|
entry: {
|
2024-05-03 18:31:14 +00:00
|
|
|
Tone: "../Tone/index.ts",
|
2018-05-18 16:10:52 +00:00
|
|
|
},
|
2019-09-16 18:03:52 +00:00
|
|
|
output: {
|
2024-05-03 18:31:14 +00:00
|
|
|
path: path.resolve(__dirname, "../build"),
|
2019-09-16 18:03:52 +00:00
|
|
|
filename: "[name].js",
|
2019-07-11 15:05:03 +00:00
|
|
|
library: "Tone",
|
2019-11-07 20:45:00 +00:00
|
|
|
libraryTarget: "umd",
|
|
|
|
globalObject: "typeof self !== 'undefined' ? self : this",
|
2018-05-18 16:10:52 +00:00
|
|
|
},
|
2019-09-16 18:03:52 +00:00
|
|
|
resolve: {
|
2024-05-03 18:31:14 +00:00
|
|
|
extensionAlias: {
|
|
|
|
".js": [".js", ".ts"],
|
|
|
|
},
|
2019-07-11 04:21:20 +00:00
|
|
|
},
|
2019-09-16 18:03:52 +00:00
|
|
|
module: {
|
|
|
|
rules: [
|
2019-07-11 04:21:20 +00:00
|
|
|
{
|
|
|
|
test: /\.ts$/,
|
2019-09-16 18:03:52 +00:00
|
|
|
use: "ts-loader",
|
2019-07-11 04:21:20 +00:00
|
|
|
exclude: /(node_modules)/,
|
2024-05-03 18:31:14 +00:00
|
|
|
},
|
|
|
|
],
|
2018-05-18 16:10:52 +00:00
|
|
|
},
|
2019-09-16 18:03:52 +00:00
|
|
|
devtool: "cheap-source-map",
|
2018-05-18 16:10:52 +00:00
|
|
|
};
|
|
|
|
|
2019-09-16 18:03:52 +00:00
|
|
|
// /////////////////////////////////////
|
2018-05-18 16:10:52 +00:00
|
|
|
// Production
|
2019-09-16 18:03:52 +00:00
|
|
|
// /////////////////////////////////////
|
2018-05-18 16:10:52 +00:00
|
|
|
|
|
|
|
const production = Object.assign({}, defaults, {
|
2019-09-16 18:03:52 +00:00
|
|
|
mode: "production",
|
|
|
|
devtool: "source-map",
|
2018-05-18 16:10:52 +00:00
|
|
|
});
|
|
|
|
|
2024-05-03 18:31:14 +00:00
|
|
|
module.exports = (env) => {
|
2019-09-16 18:03:52 +00:00
|
|
|
if (env.test) {
|
2018-05-18 16:10:52 +00:00
|
|
|
return test;
|
2019-09-16 18:03:52 +00:00
|
|
|
} else if (env.production) {
|
2018-05-18 16:10:52 +00:00
|
|
|
return production;
|
|
|
|
} else {
|
2020-05-07 13:26:49 +00:00
|
|
|
return scratch;
|
2018-05-18 16:10:52 +00:00
|
|
|
}
|
|
|
|
};
|