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

fix(v2): allow async/await in live code editor #3954

Merged
merged 1 commit into from
Dec 28, 2020
Merged
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
20 changes: 20 additions & 0 deletions packages/docusaurus-theme-live-codeblock/src/custom-buble.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

// fork of Buble which removes Buble's large dependency and weighs in
// at a smaller size of ~51kB
// https://github.com/FormidableLabs/react-live#what-bundle-size-can-i-expect
const {transform, features: bubleFeatures} = require('@philpl/buble');

// This file is designed to mimic what's written in
// https://github.com/kitten/buble/blob/mini/src/index.js, with custom transforms options,
// so that webpack can consume it correctly.
exports.features = bubleFeatures;

exports.transform = function customTransform(source, options) {
return transform(source, {...options, transforms: {asyncAwait: false}});
};
5 changes: 1 addition & 4 deletions packages/docusaurus-theme-live-codeblock/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@ module.exports = function () {
return {
resolve: {
alias: {
// fork of Buble which removes Buble's large dependency and weighs in
// at a smaller size of ~51kB
// https://github.com/FormidableLabs/react-live#what-bundle-size-can-i-expect
buble: '@philpl/buble',
buble: path.resolve(__dirname, './custom-buble.js'),
},
},
};
Expand Down