프로젝트
GitHub에서 보기
krasimir/webpack-library-starter
소개
라이브러리 제작을 위한 Webpack 기반 보일러플레이트(입력: ES6, 출력: 범용 라이브러리)
웹 및 앱What you can do
- Webpack 5 based.
- ES6 or TypeScript as a source.
- Exports in a umd format so your library works everywhere.
- Test setup with Jest.
측정된 스타 증가
- in 24h
- 0
- in 7 days
- +1
- in 15 days
- 0
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
OriginalWebpack library starter
Webpack based boilerplate for producing libraries (Input: ES6/TypeScript, Output: universal library)
Features
- Webpack 5 based.
- ES6 or TypeScript as a source.
- Exports in a umd format so your library works everywhere.
- Test setup with Jest.
Process
ES6/TypeScript source files
|
|
webpack
|
+--- babel
|
ready to use
library
in umd format
Have in mind that you have to build your library before publishing. The files under the lib folder are the ones that should be distributed.
Getting started
- Setting up the name of your library
- Open
webpack.config.jsfile and change the value oflibraryNamevariable. - Open
package.jsonfile and change the value ofmainproperty so it matches the name of your library.
- Build your library
- Run
yarn install(recommended) ornpm installto get the project's dependencies - Run
yarn buildto produce minified version of your library.
- Development mode
- Run
yarn dev. This command will generate a non-minified version of your library and will run a watcher so you get the compilation on file change.
- Running the tests
- Run
yarn test
Scripts
yarn build- produces production version of your library under thelibfolderyarn build-amd- produces an AMD version that works with RequireJSyarn dev- produces development version of your library and runs a watcheryarn dev-amd- produces an AMD development version of your library and runs a watcheryarn test- well ... it runs the tests :)yarn test-watch- same as above but in a watch mode
Readings
Misc
An example of using dependencies that shouldn’t be resolved by webpack, but should become dependencies of the resulting bundle
In the following example we are excluding React and Lodash:
{
devtool: 'source-map',
output: {
path: '...',
libraryTarget: 'umd',
library: '...'
},
entry: '...',
...
externals: {
react: 'react'
// Use more complicated mapping for lodash.
// We need to access it differently depending
// on the environment.
lodash: {
commonjs: 'lodash',
commonjs2: 'lodash',
amd: '_',
root: '_'
}
}
}
관련 프로젝트 살펴보기
불러오는 중…