Open ended question - here is a Typescript dependency that I have included in a few addons. It is very simple. Publishes a umd
format dist and that is it. Is there anything else I should be considering when building Typescript libraries for the Ember (and other) ecosystem? Sorry for the lack of specificity but looking to build a source of information / examples to help others.
import resolve from 'rollup-plugin-node-resolve';
import sourceMaps from 'rollup-plugin-sourcemaps';
const pkg = require('./package.json');
const libraryName = 'raf-pool';
export default {
external: [],
input: `dist/es/index.js`,
output: [
{ file: pkg.main, name: camelCase(libraryName), format: 'umd' }
],
plugins: [
// Allow bundling cjs modules (unlike webpack, rollup doesn't understand cjs)
commonjs(),
// Allow node_modules resolution, so you can use 'external' to control
// which external modules to include in the bundle
// https://github.com/rollup/rollup-plugin-node-resolve#usage
resolve(),
// Resolve source maps to the original source
{
"compilerOptions": {
/* Basic Options */
"moduleResolution": "node",
"target": "ES5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */
"module": "umd", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
// "lib": [], /* Specify library files to be included in the compilation. */
// "allowJs": true, /* Allow javascript files to be compiled. */
// "checkJs": true, /* Report errors in .js files. */
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
"declaration": true, /* Generates corresponding '.d.ts' file. */
"declarationDir": "dist/types",
// "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
"stripInternal": true,
"sourceMap": true, /* Generates corresponding '.map' file. */
// "outFile": "./", /* Concatenate and emit output to single file. */
Ok got a small PR going. Keeps es format when first bundling with typescript and available under pkg.json “module” field.