JS 가이드
Link documents
Getting Started
1) setup
npm install parcel-bundler --dev2) setting using javascript
const Bundler = require('parcel-bundler')
const path = require('path')
// develop, production 모드에 따라서 번들링 설정을 다르게 할 예정입니다.
const isProd = process.env.NODE_ENV === 'production'
const defaultOption = {
outDir: path.join(__dirname, '..', 'dist'),
// index.html을 불러오는 경우, publicUrl을 /로 설정해주어야 정상적으로 import가 가능했습니다.
publicUrl: '/',
detailReport: true,
cache: true,
minify: true,
sourceMaps: true,
http: ture
}
// 모드에 따라 옵션을 설정합니다.
let option
if (isProd) {
option = {
...
}
} else {
option = {
...
}
}
// 번들러를 선언해줍니다.
const bundler = new Bundler('번들링할 파일 경로', Object.assign({}, defaultOption, option))
module.exports = bundler3) Node.js Express에서 사용
4) command
Last updated
Was this helpful?