Usually in the development process, accumulated a lot of experience and skills are applied to the project, and the next time you use it began to turn around. Sometimes also want to build a class library or toolkit to accumulate their own experience skills, and no special time to build a variety of environments, such as rollup or webpack such as packaging tools, ES6 transcoding tools Babel, Eslint, jest test tools and so on. Here is deliberately done a starter project, will rollup, ES6 transcoding, Eslint, jest are integrated, peacetime use only need to accumulate modules and methods. This article refers to: based on Webpack and ES6 to build JavaScript class library http://web.jobbole.com/84858/, because the Webpack Packaging class library comes with a small loader, a bit redundant, so choose Rollup build.
# Key Notes 1. Use the ' JS API ' provided by ' rollup.js ' to package ' bundle ' 2. Using the ' ES2015 ' syntax in the ' Babel ' transcoding class Library, the ' module ' is not converted and handled by ' Rollup ' 3. The ' Node ' version is larger than ' 7.10.1 ' because the build script uses ' await ', ' async ' 4. Unit testing using ' jest ' while using ' Rollup-plugin-babel ' conversion test script syntax, config file '. BABELRC ' in ' Test ' section 5. The generation of ' Sourcemap ' is completed by ' Bundle.write ', and the transcoded source code is written to the last project address by the ' FS ' module: Https://github.com/Jinqw/rollup-libray-starter
Hope that we can all the usual efforts to accumulate, the ultimate base into their own technical high-rise.
Building JavaScript Class Library development environment based on rollup