Skip to content

How to migragte plugin "parcel-plugin-transcrypt" from V1 to V2 #7423

Closed Answered by mischnic
aihuasxy asked this question in General
Discussion options

You must be logged in to vote

Would something like this work in your case (you have to provide the used functions)?

export default new Transformer({
  async transform({asset, resolve}) {
	let inputCode = await asset.getCode();

	// Compile and bundle that file, return resulting JS and files that are used
	let result = await compilePyToJs(asset.filePath, inputCode);

	for(let f of result.includedFile) {
		asset.invalidateOnFileChange(f); // rerun this transformer after that file changed
	}

	asset.type = "js";
	asset.setCode(result.code);
    return [asset];
  },
});

The GLSL transformer is similar: https://github.com/parcel-bundler/parcel/blob/v2/packages/transformers/glsl/src/GLSLTransformer.js

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@JennaSys
Comment options

@JennaSys
Comment options

Answer selected by aihuasxy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants