parcel - Offirmo-team/wiki GitHub Wiki

Voir aussi webpack, babel...

Introduction

https://parceljs.org/

v2

pas prêt

v1

Utilisation

.babelrc

{
	"plugins": [
		"transform-class-properties"
	],
	"presets": [
		"react",
		[
			"env",
			{
				"targets": {
					"browsers": [
						"last 2 Chrome versions",
						"last 2 Firefox versions"
					]
				}
			}
		],
		"stage-0"
	]
}

package.json

	"devDependencies": {
		"@offirmo/view-css": "^0.0.1",
		"babel-plugin-transform-class-properties": "^6",
		"babel-polyfill": "^6",
		"babel-preset-env": "^1",
		"babel-preset-react": "^6",
		"babel-preset-stage-0": "^6",
		"babel-runtime": "^6",
		"npm-run-all": "^4",
		"parcel-bundler": "^1",
		"react": "^16",
		"react-dom": "^16"
	},
	"scripts": {
		"clean": "rm -rf dist .cache",
		"start:parcel": "parcel src/index.html",
		"start": "run-s clean start:parcel"
	}

Avancé

https://yarnpkg.com/package/parcel-plugin-bundle-visualiser

Problèmes rencontrés

"Unexpected token" on ES6 stuff in node_modules

  1. need to expose the un-transpiled source in package.json "source"
  2. the whole chain to this module needs a .babelrc (and maybe "source")

Duplicate plugin/preset detected

Look at plugin AND preset in all the chain (cf. above)