qinshixixing-parcel v0.4.0
qinshixixing-parcel
This is a package for parcel which has some pre-configure.
Installation
npm i -D qinshixixing-parcel
Usage
By command line
For pruduction
qsxx-parcel build
For development
qsxx-parcel watch
For development and start a web service
qsxx-parcel dev
By node.js API
New parcelTask
const QsxxParcel = require('qinshixixing-parcel');
const config = {
input: ts,
outputDir: 'dist',
outputName: 'build.js'
};
const parcelTask = new QsxxParcel(config);
For pruduction
parcelTask.build();
For development
parcelTask.watch();
For development and start a web service
parcelTask.dev();
Configure type
parameter
If you use node.js api and set the options in parameter. Just like the example above.
qsxx-parcel.config.json
If there is a file named "qsxx-parcel.config.json" in the directory which you run node.js(just the same as "process.cwd()"), the content of the file will be the configure.
Options
basePath: string
The root directory of the project.
default value: process.cwd()
updateConfig: boolean
This option is used to set whether to update package.json, .babelrc, .postcssrc and .posthtmlrc.
default value: true
note:
If you have set "qsxx-parcel.config.json" as the configure file, this option will be reset to false after you begin to run the parcel task. If you use node.js api and set the configure in javascript file, it's better to set this option to false by manual.
input: string
The path to the entry file.
default value: 'src/index.html'
outputDir: string
The path to the directory which the output file will be put. The same as the configure 'outDir' of parcel.
default value: 'build'
outputName: string
The name of the output file. The same as the configure 'outFile' of parcel.
default value: The same as the input file name.
cache: boolean
Enabled or disables caching. The same as the configure 'cache' of parcel.
default value: false
publicUrl: string
The url to server on. The same as the configure 'publicUrl' of parcel.
default value: './' or 'devServerDir'
note:
If you are in development mode and starting a web service, the value of this option will be set to 'devServerDir' and you can't change it. In other case, the default value is './' and you can change it by set this option.
target: string
The environment where your project code will run. The following value is valid:
'browser'
'node'
'electron'
The same as the configure 'target' of parcel.
default value: 'browser'
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago