You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 26, 2019. It is now read-only.
Running npm 5.10 node 8.94.
Totally clean start with one linked modules.
I am trying this out with dev mode npm start
Is putting react component typescript components into a npm package something that should work ?
I created a trivial local module with a single react component button TestButton.tsx it fails the solution compiles for the wrong reason.
My import import TestButton from 'lib/components/TestButton' from my local module lib is treated as a file-loader dependency. As a test I ejected to see if adding /\.(ts|tsx)$/, to exclude helped and it gets past being treated as a file asset.
{
// Exclude `js` files to keep "css" loader working as it injects
// its runtime that would otherwise processed through "file" loader.
// Also exclude `html` and `json` extensions so they get processed
// by webpacks internal loaders.
exclude: [/\.(js|jsx|mjs)$/, /\.html$/, /\.json$/],
loader: require.resolve('file-loader'),
options: {
name: 'static/media/[name].[hash:8].[ext]',
},
},
After modify exclude to. exclude: [/\.(ts|tsx)$/,/\.(js|jsx|mjs)$/, /\.html$/, /\.json$/],
I then get another error
../lib/components/TestButton.tsx
Module parse failed: Unexpected token (3:7)
You may need an appropriate loader to handle this file type.
| import * as React from 'react'
| // stuff here
| export interface IProps {
| onClick: () => void
| }