Skip to content
This repository has been archived by the owner on Feb 19, 2021. It is now read-only.

A plugin for building projects that utilize @sprucelabs/schema as well as a script for mapping tsconfig paths. 💪

Notifications You must be signed in to change notification settings

sprucelabsai/babel-plugin-schema

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

babel-plugin-schema

This module ships with 2 components:

  1. When used with babel in a monorepo, it copies the @sprucelabs/spruce-schema module to the node_modules of the packages that need it so each project can utilize it's local path aliases.
  2. A resolve-path-aliases command that can resolve path aliases configured in your projects tsconfig.json.

Installing

yarn add @sprucelabs/babel-plugin-schema

Adding to Babel config in monorepo

Add @sprucelabs/babel-plugin-schema with the options exactly as is:

[
	"@sprucelabs/babel-plugin-schema",
	{ cwd: __dirname, destination: process.env.PWD },
];

Babel config example

module.exports = (api) => {
	api.cache(true);
	return {
		sourceMaps: true,
		presets: ["@babel/preset-env", "@babel/preset-typescript"],
		plugins: [
			[
				"@sprucelabs/babel-plugin-schema",
				{
					cwd: __dirname,
					destination: process.env.PWD,
				},
			],
			"@babel/plugin-transform-runtime",
			[
				"@babel/plugin-proposal-decorators",
				{
					legacy: true,
				},
			],
			["@babel/plugin-proposal-class-properties", { loose: true }],
			[
				"module-resolver",
				{
					root: ["./"],
					alias: {
						"#spruce": "./src/.spruce",
					},
				},
			],
		],
	};
};

Resolving path aliases

About

A plugin for building projects that utilize @sprucelabs/schema as well as a script for mapping tsconfig paths. 💪

Resources

Stars

Watchers

Forks

Packages

No packages published