diff --git a/scripts/build.js b/scripts/build.js index 0b4c92ce..d05586f6 100644 --- a/scripts/build.js +++ b/scripts/build.js @@ -1,5 +1,5 @@ const ncc = require("../src/index.js"); -const { statSync, writeFileSync } = require("fs"); +const { statSync, writeFileSync, readFileSync } = require("fs"); const { promisify } = require("util"); const { relative } = require("path"); const copy = promisify(require("copy")); @@ -73,6 +73,7 @@ async function main() { writeFileSync(__dirname + "/../dist/ncc/loaders/relocate-loader.js", relocateLoader); writeFileSync(__dirname + "/../dist/ncc/loaders/shebang-loader.js", shebangLoader); writeFileSync(__dirname + "/../dist/ncc/loaders/ts-loader.js", tsLoader); + writeFileSync(__dirname + "/../dist/ncc/loaders/uncacheable.js", readFileSync(__dirname + "/../src/loaders/uncacheable.js")); // copy typescript types await copy( diff --git a/src/index.js b/src/index.js index a31e76b1..5e0d90f1 100644 --- a/src/index.js +++ b/src/index.js @@ -135,6 +135,9 @@ module.exports = ( { test: /\.tsx?$/, use: [{ + loader: __dirname + "/loaders/uncacheable.js" + }, + { loader: __dirname + "/loaders/ts-loader.js", options: { compilerOptions: { diff --git a/src/loaders/uncacheable.js b/src/loaders/uncacheable.js new file mode 100644 index 00000000..e82a3457 --- /dev/null +++ b/src/loaders/uncacheable.js @@ -0,0 +1,4 @@ +module.exports = function (input) { + this.cacheable(false); + return input; +}; \ No newline at end of file