Comments (8)
Oh, solution found
modules: [path.resolve('./src'), path.join(__dirname, 'node_modules')],
from webpack-library-starter.
I resolved my issue by adding the following into the config object:
target: 'node'
a good read from jlongster blog
from webpack-library-starter.
Sorry for the late reply. Is there require('jquery')
inside your library. If yes, then this result is correct.
from webpack-library-starter.
So the library will be bundled together with all its dependencies?
For example if I have import 'angular'
then angular will be bundled with my library?
Is there a way to bypass this?
Thanks
from webpack-library-starter.
@adamkleingit the proper way for handling this case is webpack's externals.
@riskers Now, when I'm reading your question again I think I understood what's going on. Correct me if I'm wrong but you build your library using webpack and then you have a build step (again using webpack) that uses your library. If that's the case then you'll have to use externals
option one more time in your build process.
from webpack-library-starter.
But how to include dependencies into your library?
If I use something like import _ from "lodash"
it generate an error while building
Module not found: Error: Can't resolve 'lodash' in...
Once I include lodash in externals
option it builds perfectly, but library needs lodash as dependency.
Thanks!
from webpack-library-starter.
@gen4sp I've tried your solution above on including dependencies but it's not working correctly because it's now looking for all its dependencies.
I'm trying to include request library.
from webpack-library-starter.
@riskers do we have to keep the issue open?
from webpack-library-starter.
Related Issues (20)
- Do you think to add Prettier to the project in the future? HOT 1
- about babel plugin. HOT 1
- Yarn: unmet peer dependency HOT 1
- Include a simple demo/docs page? HOT 4
- Webpack 4 incompatible HOT 3
- Intellisense doesnโt work after transpiled HOT 2
- Unable to use produced library.js as 3rd party. HOT 10
- Webpack4, babel7 HOT 2
- Consider making it a Yeoman|whatever-generator generator ? HOT 1
- How to use RequireJS client-side to load the Cat & Dog modules HOT 1
- Launch dev server for index.html consuming the dev library HOT 2
- Use Source Maps in Mocha Tests HOT 1
- transpiling to ES2015? Have a potential solution. HOT 1
- Doesn't support ...spread operator?
- Transpile with statics HOT 1
- How to use dynamic import HOT 1
- Help with browser HOT 1
- webpack cli error on build
- Conceptual doubt if using this project applies to my problem HOT 2
- Module build failed: Error: Cannot find module 'babel-helper-builder-binary-assignment-operator-visitor'
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from webpack-library-starter.