diff --git a/dist/webpack/lazy-controller-loader.js b/dist/webpack/lazy-controller-loader.js index 75b4176..a93c5eb 100644 --- a/dist/webpack/lazy-controller-loader.js +++ b/dist/webpack/lazy-controller-loader.js @@ -5583,7 +5583,7 @@ function getCommentsFromSource(source) { parse(source, { onComment: comments, sourceType: 'module', - ecmaVersion: 2020, + ecmaVersion: 2022, }); return comments; } diff --git a/src/util/get-stimulus-comment-options.ts b/src/util/get-stimulus-comment-options.ts index 65a2bb3..1d301c0 100644 --- a/src/util/get-stimulus-comment-options.ts +++ b/src/util/get-stimulus-comment-options.ts @@ -24,7 +24,7 @@ function getCommentsFromSource(source: string) { parse(source, { onComment: comments, sourceType: 'module', - ecmaVersion: 2020, + ecmaVersion: 2022, }); return comments; diff --git a/test/util/get-stimulus-comment-options.test.ts b/test/util/get-stimulus-comment-options.test.ts index 5497b5d..19aa565 100644 --- a/test/util/get-stimulus-comment-options.test.ts +++ b/test/util/get-stimulus-comment-options.test.ts @@ -42,4 +42,12 @@ describe('getStimulusCommentOptions', () => { errors: [], }); }); + + it('parses source with static properties', () => { + const src = '/* stimulusFetch: "lazy" */ export default class extends Controller { static targets = []; }'; + expect(getStimulusCommentOptions(src)).toEqual({ + options: { stimulusFetch: 'lazy' }, + errors: [], + }); + }); });