Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid transpiling class-properties as they are natively supported #449

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 1 addition & 70 deletions lib/babel-options-util.js
Original file line number Diff line number Diff line change
Expand Up @@ -321,30 +321,10 @@ function _addDecoratorPlugins(plugins, options, config, parent, project) {
} else {
addPlugin(
plugins,
[require.resolve("@babel/plugin-proposal-decorators"), { legacy: true }],
_buildClassFeaturePluginConstraints(
{
before: ["@babel/plugin-proposal-class-properties"],
},
config,
parent,
project
)
[require.resolve("@babel/plugin-proposal-decorators"), { legacy: true }]
);
}

if (hasPlugin(plugins, "@babel/plugin-proposal-class-properties")) {
if (parent === project) {
project.ui.writeWarnLine(
`${_parentName(
parent
)} has added the class-properties plugin to its build, but ember-cli-babel provides these by default now! You can remove the transforms, or the addon that provided them, such as @ember-decorators/babel-transforms.`
);
}
} else {
_addClassProperties(addPlugin, plugins, options, config, parent, project);
}

if (hasPlugin(plugins, "babel-plugin-filter-imports")) {
let checker = new VersionChecker(parent).for(
"babel-plugin-filter-imports",
Expand All @@ -365,54 +345,6 @@ function _addDecoratorPlugins(plugins, options, config, parent, project) {
return plugins;
}

function _addClassProperties(addPlugin, plugins, options, config, parent, project) {
addPlugin(
plugins,
[
require.resolve("@babel/plugin-proposal-class-properties"),
{ loose: options.loose || false }
],
_buildClassFeaturePluginConstraints(
{
after: ["@babel/plugin-proposal-decorators"],
},
config,
parent,
project
)
);
addPlugin(
plugins,
[
require.resolve("@babel/plugin-proposal-private-methods"),
{ loose: options.loose || false }
],
_buildClassFeaturePluginConstraints(
{
after: ["@babel/plugin-proposal-decorators"],
},
config,
parent,
project
)
);
addPlugin(
plugins,
[
require.resolve("@babel/plugin-proposal-private-property-in-object"),
{ loose: options.loose || false }
],
_buildClassFeaturePluginConstraints(
{
after: ["@babel/plugin-proposal-decorators"],
},
config,
parent,
project
)
);
}

function _addTypeScriptPlugin(plugins, parent, project) {
const { hasPlugin, addPlugin } = require("ember-cli-babel-plugin-helpers");

Expand All @@ -433,7 +365,6 @@ function _addTypeScriptPlugin(plugins, parent, project) {
],
{
before: [
"@babel/plugin-proposal-class-properties",
"@babel/plugin-proposal-private-methods",
"@babel/plugin-proposal-decorators",
],
Expand Down
1 change: 0 additions & 1 deletion lib/ember-plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ function _getProposalDecoratorsAndClassPlugins(config) {
if (!config.shouldIgnoreDecoratorAndClassPlugins) {
return [
["@babel/plugin-proposal-decorators", { legacy: true }],
["@babel/plugin-proposal-class-properties"],
];
}
}
Expand Down