profile
viewpoint
Jirat Ki. n3tr @wework Singapore http://n3tr.com JS, React, NodeJS, Swift/ObjC and Python

n3tr/bx-price-tracker 19

Bx.in.th : Trading price tracker bar

GucodeLive/gucode-react-tutorial 8

Code from Gucode EP.5 - React Tutorial

n3tr/Contact-Manager 3

An example of conversion Backbone contact manager app to React + Redux + React Router.. Webpack.. :package:

n3tr/9tail 2

9tail - All source code from 9tail.com, it was developed in PHP and Codeigniter Framework

n3tr/backbone-rails 1

Easily use backbone.js with rails 3.1

create barnchn3tr/svg-path-drawing-viewer

branch : master

created branch time in 9 days

created repositoryn3tr/svg-path-drawing-viewer

created time in 9 days

pull request commentjaredpalmer/tsdx

Add JSX extension to @rollup/plugin-node-resolve options

@agilgur5 I added a comment and tests

n3tr

comment created time in a month

Pull request review commentjaredpalmer/tsdx

Add JSX extension to @rollup/plugin-node-resolve options

 export async function createRollupConfig(           'main',           opts.target !== 'node' ? 'browser' : undefined,         ].filter(Boolean) as string[],+        extensions: ['.mjs', '.js', '.jsx', '.json', '.node'],

Updated

n3tr

comment created time in a month

push eventn3tr/tsdx

Jirat Ki

commit sha d6def208d937f905388d37d7403cb3ba61e4858b

Correct comment link

view details

push time in a month

push eventn3tr/tsdx

Jirat Ki

commit sha 8b0af56b2d4cf480ea92db5033e7c0b36bdc8c7a

Add test for JSX chaining import

view details

push time in a month

Pull request review commentdevelopit/microbundle

Support import JSX from JS file

 function createConfig(options, entry, format, writeMeta) { 					nodeResolve({ 						mainFields: ['module', 'jsnext', 'main'], 						browser: options.target !== 'node',+						extensions: ['.mjs', '.js', '.jsx', '.json', '.node'],

I just add jsx to the list of the default values, nothing should be different for TypeScript. :)

n3tr

comment created time in a month

push eventn3tr/microbundle

Jirat Ki

commit sha 875558b9ff1c0e618b517d786b1b4a363ca43a52

Add comment

view details

push time in a month

PR opened developit/microbundle

Support import JSX from JS file

Changes

  • Support import JSX from JS file by adding extension to rollup node-resolve plugin to

Background

I have experience an error when importing .jsx file from .js file like

index.js -> A.jsx

will cause an error

Could not resolve './A' from src/index.js

However, Importing .jsx file from TypeScript file (.ts) file is seems working fine except the the import is chaining more than 3 levels depth.

index.ts -> A.jsx # This is fine
index.ts -> A.jsx  -> B.jsx # This is fine

index.ts -> A.jsx  -> B.jsx -> C.jsx 
# Error: Could not resolve './C' from src/jsx-components/B.jsx

To reproduce the issue

git clone -b import-jsx-error --single-branch git@github.com:n3tr/microbundle-example.git
cd microbundle-example

yarn

yarn build --jsx React.createElement ./src/index.js 
# or
yarn build --jsx React.createElement ./src/index.ts


I'm not really sure what is the root cause of the error, by adding extensions seems to fix the problem.

+1 -0

0 comment

1 changed file

pr created time in a month

create barnchn3tr/microbundle-example

branch : import-jsx-error

created branch time in a month

create barnchn3tr/microbundle-example

branch : resolve-jsx

created branch time in a month

create barnchn3tr/microbundle-example

branch : master

created branch time in a month

created repositoryn3tr/microbundle-example

created time in a month

create barnchn3tr/microbundle

branch : node-resolve-extensions

created branch time in a month

PR opened jaredpalmer/tsdx

Add extensions to @rollup/plugin-node-resolve options

close #523

Provide extensions to rollup plugin-node-resolve to includes .jsx.

The default value (['.mjs', '.js', '.json', '.node']) is not including .jsx, It causes an error when import a .jsx from js or jsx file.

+1 -0

0 comment

1 changed file

pr created time in a month

create barnchn3tr/tsdx

branch : node-resolve-ext

created branch time in a month

issue openedjaredpalmer/tsdx

Could not resolve .jsx file when import from other .jsx

Current Behavior

Encounter an error

Error: Could not resolve './ComponentC' from src/ComponentB.jsx

When import JSX file from JSX file when dependencies more than 2 levels deep, eg

index.ts -> A.jsx -> B.jsx -> C.jsx # Error

Below is working fine

index.ts -> A.jsx -> B.jsx 

# or

index.ts -> A.jsx -> B.jsx -> C.jsx
index.ts -> B.sjx

Repo for reproducing

  • https://github.com/n3tr/tsdx-import-jsx-test

Expected behavior

The build command should be successfully

Suggested solution(s)

I don't really know the root cause of this, but trying to set extensions: ['.mjs', '.js', '.jsx', '.json', '.node'] to rollup-plugin-typescript2 seems to solve the issue.

https://github.com/jaredpalmer/tsdx/blob/3a6d42fb767150233c651056aabda9dd91bd048d/src/createRollupConfig.ts#L105-L111

Additional context

<!-- Add any other context about the problem here. -->

Your environment

<!-- PLEASE FILL THIS OUT -->

Software Version(s)
TSDX 0.12.3
TypeScript 3.8.2
Browser
npm/Yarn
Node v12.4.0
Operating System

created time in a month

push eventn3tr/tsdx-import-jsx-test

Jirat Ki

commit sha 2af3c1f40991e791863b50f08e33ff2a0023e169

Fix entry point export

view details

push time in a month

push eventn3tr/tsdx-import-jsx-test

Jirat Ki

commit sha 4e5adfe84c742e2039fa623e7f4ddea3949f1764

remove unused props and index.tsx to index.ts

view details

push time in a month

fork n3tr/microbundle

📦 Zero-configuration bundler for tiny modules.

https://npm.im/microbundle

fork in a month

starteddevelopit/microbundle

started time in a month

create barnchn3tr/tsdx-import-jsx-test

branch : master

created branch time in a month

created repositoryn3tr/tsdx-import-jsx-test

created time in a month

issue commentfacebook/create-react-app

propTypes not included in compiled JS

This might be related to https://github.com/facebook/create-react-app/issues/209

sandorvasas

comment created time in 2 months

starteduber-web/probe.gl

started time in 3 months

fork n3tr/coding-interview-university

A complete computer science study plan to become a software engineer.

fork in 3 months

more