Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File paths become relative after execution #15

Open
zhamidi opened this issue Nov 5, 2020 · 0 comments
Open

File paths become relative after execution #15

zhamidi opened this issue Nov 5, 2020 · 0 comments

Comments

@zhamidi
Copy link

zhamidi commented Nov 5, 2020

I am trying to use tsickle-loader to transpile over 140 TypeScript files that are part of the same project into JS that I can later feed into Closure Compiler.
This is my webpack.config.js file:

const path = require("path");
const fs = require("fs");

const walkSync = function (dir, filelist) {
  const files = fs.readdirSync(dir);
  filelist = filelist || [];
  files.forEach(function (file) {
    if (fs.statSync(dir + file).isDirectory()) {
      filelist = walkSync(dir + file + "/", filelist);
    } else {
      filelist.push(dir + file);
    }
  });
  return filelist;
};

let input = walkSync("./src/", []).filter(f => f.endsWith(".ts") || f.endsWith(".json"));

module.exports = {
  entry: input,
  output: {
    path: path.resolve("./ts2compiler")
  },
  module: {
    rules: [
      {
        test: /\.ts$/,
        use: {
          loader: "tsickle-loader",
          options: {
            tsconfig: path.resolve(__dirname, "tsconfig.json"),
            externDir: "./ts2compiler"
          }
        }
      }
    ]
  }
};

The ẁalkSync function is to go through all the files that are in the different directories.
When I run the command ./node_modules/.bin/webpack --config webpack.config.js after a while I get the same error for all my files:
image

I tried both having my paths as absolute and relative in the entry property and it changes nothing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant