-
Notifications
You must be signed in to change notification settings - Fork 507
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
HOWTOs #379
Comments
How to correctly transpile spread on iterables (Set, Map) #376
"downlevelIteration": true
{
"scripts":
{
"build": "tsdx build --target node"
}
} |
How to change output folder name from "dist" to "build" #351
module.exports = {
rollup(config, options) {
config.output.file = config.output.file.replace('dist', 'build');
return config;
},
}; |
How to 'play nicely' with tsdx + VS Code + eslint #354https://github.com/jaredpalmer/tsdx#npm-run-lint-or-yarn-lint |
nice. worth adding to docs when you think its ready. |
@sw-yx yep) can you plz add label |
Could we pin this issue like the who is using this lib issue? :) |
How to configure project to use aliases in module's import to avoid '../../../' hell #374 (comment) #336
"devDependencies": {
"babel-plugin-module-resolver": "^4.0.0"
}
"compilerOptions": {
"baseUrl": "./",
"paths": {
"comp": ["./src/comp"],
"utils": ["./src/utils"],
"*": ["src/*", "node_modules/*"]
}
}
"plugins": [
[
"module-resolver",
{
"root": "./",
"alias": {
"comp": "./src/comp",
"utils": "./src/utils",
"*": ["src/*", "node_modules/*"]
}
}
]
] advanced solution #374 (comment) module.exports = {
// ...
plugins: [
// ... other plugins
[
'babel-plugin-module-resolver',
{
root: './',
alias: require('./tsconfig.json').compilerOptions.paths,
},
],
],
} |
How to ship components with images properly #278 (comment) #386thanks @vongohren for suggestion
const images = require('@rollup/plugin-image');
module.exports = {
rollup(config, options) {
config.plugins = [
images({ include: ['**/*.png', '**/*.jpg'] }),
...config.plugins,
]
return config
},
} |
For information, this might be fresh and good in the latest versions: #379 (comment)Old history@ambroseus why is your version so complex? What is the value going out of this? This is the code I ended up using
|
For information, this might be fresh and good in the latest versions: #379 (comment)Old historyHow to load a font into the code. Force inline wrapping the option in url plugin, to
Then you can use this wherever you need in the code, also as a Global font face in emotion.
|
@vongohren thanks for the solution! |
A slightly better approach to configure aliases and avoid specifying folders manually:
"devDependencies": {
"babel-plugin-module-resolver": "^4.0.0"
}
"compilerOptions": {
"include": [ "src" ],
"baseUrl": "./src"
}
const { readdirSync } = require('fs');
const resolveAlias = readdirSync("./src", { withFileTypes: true })
.filter(entry => entry.isDirectory())
.reduce(
(aliases, dir) => {
aliases[dir.name] = "./src/" + dir.name;
return aliases;
}, { "*": ["src/*", "node_modules/*"] });
module.exports = function (api) {
api.cache(true);
return {
plugins: [
[ "module-resolver", { root: "./", alias: resolveAlias } ]
]
};
} |
There should be HOWTO for Visual Studio Code's Jest plugin as well (maybe something like eslint's "write to file") |
@ambroseus @vongohren I tried using your Unfortunately, it is still not working. Both when importing it from an app and also by running I have tested it by using |
@arvinsim that is strrange, because I use it in prod right now, and it works even fine in storybook Are you using this comment? Because that is what im using |
@vongohren May I know what version of TSDX and plugins that you are using? My package versions
|
@vongohren Okay so I found the issue. It was because |
@agilgur5 awesome! HOWTO with rpt2 & objectHashIgnoreUnknownHack was removed |
How to configure a static assets folder// tsdx.config.js
let static_files = require('rollup-plugin-static-files');
module.exports = {
rollup(config) {
config.plugins.push(
static_files({
include: ['./static'],
})
);
return config;
},
}; good for shipping static CSS that the user can import without assuming bundler setup |
Let’s get these into the new docs site |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
I tried to follow @vongohren's Font How-To #379 (comment) I added the rollup dependency: yarn add --dev @rollup/plugin-url Instead of I had to add a declare module '*.woff2'; However, I'm having an issue in which the fonts are not being found when running
My import { css } from '@emotion/react'
import MyFontRegular from './assets/fonts/MyFont/MyFont-Regular.woff2';
export const fontStyles = css`
@font-face {
font-family: 'My Font';
font-style: normal;
font-weight: 400;
src: url(${MyFontRegular}) format('woff2');
}
` I'm not sure where I am going wrong. This is basically off a vanilla tsdx project using the |
@ambroseus I struggled for some time with the In your example, the options object should include an array of TypeScript "plugins": [
[
"module-resolver",
{
"root": "./",
"alias": {
"comp": "./src/comp",
"utils": "./src/utils",
"*": ["src/*", "node_modules/*"]
},
"extensions": [".ts", ".tsx"]
}
]
] |
I've released https://github.com/UnlyEd/simple-logger and now I would like to automatically create a GitHub release when publishing to NPM, what github action do you recommend? Are there any example out there? |
@arvigeus , I think there's a small typo in your comment for aliasing for the I believe this
should be this:
( |
this solution doesn't appear to work for test execution, is there any workaround? |
I have an Issue. I want to know how to change port number when running an development mode. |
Hey, is it possible to include these static files within a specified directory, instead of just the root of dist |
up |
I got HTML files within a node module that are being used as an email template. |
Import your assets like this , rather than using import: and in your
|
This works but when I set include: ['./src/assets', './src/styles'], it copies the files and folders in assets and styles straight into dist folder not under dists>assets and dist>styles |
The answer is I should have simply set include: ['./src']. |
Collection of useful HOWTOs
The text was updated successfully, but these errors were encountered: