$ npm install imod
yarn global add imod
# or
sudo npm install imod -g
imod init ./hello
add these into package.json
{
"main": "dist/index.js",
"module": "dist/index.mjs",
"types": "dist/types/index.d.ts",
"scripts": {
"build": "imod build",
"dev": "imod dev"
}
}
imod dev
imod build
import Imod from 'imod'
const iMod = new IMod({
cwd: __dirname + '/../..'
})
iMod.build()
iMod.dev()
imod init ./hello --templateName=module --lite=true # If you don't use '--lite', it will try to install node_modules
package.json, ./imod.config.js, ./imod.config.json, ./imodconfig.js, ./imodconfig.json./imod.config.js -> ./imod.config.json -> imodconfig.js -> imodconfig.json -> ${package.json}.config.imodthis is the default configuration:
module.exports = {
name: moduleName, // if not set, will guess from ${package.json}.name
banner: '', // if not set, return ''
input: '', // string | string[] | null. if not set, will find src/index*{.ts,.tsx,.js,.jsx,.es6,.es,.mjs}
outDir: '', // string. default is './dist'
declarationDir: false, // string | false. if false will no typings
compilerOptions: [
{
format: 'esm',
extName: '.mjs',
target: 'esnext'
},
{
format: 'cjs',
extName: '.js',
target: 'es5'
},
{
format: 'umd',
extName: '.min.js',
target: 'es5'
}
]
}
© 2010 - cnpmjs.org x YWFE | Home | YWFE