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

How to change output folder? #791

Closed
alonfai opened this issue Aug 10, 2020 · 1 comment
Closed

How to change output folder? #791

alonfai opened this issue Aug 10, 2020 · 1 comment
Labels
kind: feature New feature or request problem: removed issue template OP removed the issue template without good cause solution: duplicate This issue or pull request already exists

Comments

@alonfai
Copy link

alonfai commented Aug 10, 2020

@agilgur5 Thanks for answering that. I found another issue relating to changing the output folder

I modify both the rollup output param and the tsconfig.json outDir and declarationDir to a parent folder of my project that is used for debugging my app that consumes the bundled output.

tsconfig.json

"compilerOptions": {
     "baseUrl": "./src",
      "outDir": "../../my-app/src/@scope/shared",
      "declarationDir": "../../my-app/src/@scope/shared"
      "allowJs": true,
      "alwaysStrict": true,
      "declaration": true,
      "esModuleInterop": true,
      "forceConsistentCasingInFileNames": true,
      "importHelpers": true,
      "jsx": "react",
      "lib": ["dom", "esnext"],
      "module": "esnext",
      "moduleResolution": "node",
      "noFallthroughCasesInSwitch": true,
      "noImplicitThis": true,
      "strictFunctionTypes": true,
      "strictPropertyInitialization": true,
      "strict": true,
      "allowSyntheticDefaultImports": true,
      "noUnusedParameters": false,
      "noUnusedLocals": false,
      "strictNullChecks": true,
      "noImplicitAny": false,
      "noEmit": true,
      "target": "es5",
      "sourceMap": true,
      "downlevelIteration": true
    }

tsdx.config.js

module.exports = {
  rollup(config, options) {
    return {
      ...config,
      // https://github.com/formium/tsdx/issues/213#issuecomment-540126058
      output: {
        ...config.output,
        // dir: path.join(__dirname, '../../my-app/src/@scope'),
        file: `../../my-app/src/@scope/shared/${path.basename(file)}`
      }
    }
    }
  }
};

The resulting run of tsdx build gives me the bundled esm/cjs for both development/production .js builds with the relevant typings, however I still have a dist folder under my scoped rollup project with the entry index.js file.

I attached a few pics to demonstrate the issue.

// current tsdx/rollup project with a single index.js under `shared/dist folder

Screen Shot 2020-08-10 at 4 03 13 pm

'use strict'

if (process.env.NODE_ENV === 'production') {
  module.exports = require('./shared.cjs.production.min.js')
} else {
  module.exports = require('./shared.cjs.development.js')
}

// The other project that consumes the bundled output

Screen Shot 2020-08-10 at 4 05 40 pm

Originally posted by @alonfai in #790 (comment)

@agilgur5
Copy link
Collaborator

agilgur5 commented Aug 10, 2020

Please don't remove issue templates, they are there for a reason. As I said in your other issue, this is another duplicate, this time of #351 (comment) . Please search the issues and read through docs before new submitting issues.


Also outDir is not currently supported by TSDX

@agilgur5 agilgur5 added the solution: duplicate This issue or pull request already exists label Aug 10, 2020
@agilgur5 agilgur5 changed the title Output different folders with tsdx and tsconfig settings How to change output folder? Aug 10, 2020
@agilgur5 agilgur5 added the problem: removed issue template OP removed the issue template without good cause label Aug 10, 2020
Repository owner locked and limited conversation to collaborators Aug 17, 2020
@agilgur5 agilgur5 added the kind: feature New feature or request label Sep 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind: feature New feature or request problem: removed issue template OP removed the issue template without good cause solution: duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants