score:1
found an answer by michael jungo in a similar question: https://stackoverflow.com/a/44542254/4513747
a webpack bundle does not expose your exports by default, as it assumes that you're building an app and not a library (which is the far more common use of webpack). you can create a library by configuring
output.library
andoutput.librarytarget
the documentation at https://webpack.js.org/guides/author-libraries, walks you through the process of using webpack for bundling a library.
using the output in webpack.config.js
as in the following, exposes the export
s when bundling.
output: {
path: path.join(__dirname, 'dist'),
filename: '[name]/index.js',
library: 'yourlibraryname',
librarytarget: 'umd',
},
more information on this can be found at https://webpack.js.org/configuration/output/#output-library
Source: stackoverflow.com
Related Query
- React.createElement: type is invalid error after bundling and importing react component to another react app
- Element type is invalid error using react-native and react navigation
- Getting Error "React.createElement: type is invalid -- expected a string" when using React Router and external component that imports other Components
- React Route v4 and PrivateRoute gives error - React.createElement: type is invalid
- Error when importing react component from a git repo dependancy: Element type is invalid
- React production error with service worker: invalid MIME type
- Creating reusable Button Component with React and Typescript with not assignable type error
- React invalid hook call error and storybook 6
- Importing and using component from custom React Component Library results in Invariant Violation: Invalid hook call
- React google Login firing error on render and after sign in
- How to solve element type invalid error in react
- Typescript error after update of react and react-dom
- How to fix the type error Type '(string | Element) [] is not assignable to type 'string | Element | undefined' using react and typescript?
- React Error - Uncaught Invariant Violation: Element type is invalid
- React - Redux Error: Element type is invalid after connect
- Error after using docker compose up in react and express project
- Using state and includes in React gives Argument of type 'number' is not assignable to parameter of type 'never' error
- React Victory giving error Invalid prop `data` of type `object` supplied to `VictoryLabel`, expected `array`
- importing functional component and getting Element type is invalid
- TypeScript gives 'Object is possibly undefined' error after importing object in React component
- LeafletMap is showing error even after importing the leaflet package in react js
- Getting Invalid hook call error on importing a component in React
- CORs error AFTER deploying React App and separate Node API to production Unbuntu server where React static files are servered with NGINX
- React 4 Router error = type is invalid expected string but got undefined
- React JS Error after requiring ReactRouter - Warning: React.createElement: type should not be null, undefined, boolean, or number
- How to fix error type void is not assignable to type using react and typescript?
- Type 'string' is not assignable to type 'never' and Type 'unknown' is not assignable to type 'never' error in react typescript
- How to solve API fetch and type error in React
- React Antd Element Type Invalid... got: Object... Error after upgrade
- Error while importing font or images file inside scss using Webpack 4 and react js
More Query from same tag
- React Hook useEffect has a missing dependency: 'loading'. Either include it or remove the dependency array react-hooks/exhaustive-deps
- How to properly setup the barryvdh/laravel-cors in reactjs
- How to update the button title?
- How to override Material-UI Popover styles?
- Want to make show more functionality using reactjs
- How to receive a file from frontend using post method and upload it to google cloud?
- React : How to use the result of an API call, in my JSX? (scope problem)
- Jest unit test fails but it shouldnt
- Typescript React Functional Component with props.children
- Pass something to render function
- How to include local script file on React page?
- axios not returning the status of called api if error in reactjs
- Is there any proper way to send a POST request through React using fetch()?
- Building search filter using ReactJs, and Node.js
- React SSR, NextJS vs Chrome headless prerendering
- Authentication using ReactJS and Firebase
- Warning: ant Checkbox: value is not a valid prop, do you mean checked?
- How is an argument for a callback in React being passed from the child component to the parent component?
- "Two children with the same key" error when trying to populate a multi-select dropdown
- how to create login ui and user can choose role after login they redirect to rolebased dashboard in mern stack
- React js loop through array received from blade
- How can I disable/enable the button based on multiple checkboxes state in React.js
- i18n for array elements of react component
- Custom hook returns Promise but resolves inside useEffect
- Insert more than one row material table
- React - Changing state in context not rerendering DOM
- updating state with new state in redux
- Jest mock async calls inside react component
- Delay a loop with timeout in react js
- Search filter by first and last name in React not behaving as expected