Skip to content

Commit 53a4e3d

Browse files
authored
clients: convert extension to ES modules (GoogleChrome#14181)
1 parent 133cb9f commit 53a4e3d

File tree

7 files changed

+10
-16
lines changed

7 files changed

+10
-16
lines changed

build/build-extension.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ async function buildEntryPoint() {
3939
rollupPlugins.replace({
4040
'___BROWSER_BRAND___': browserBrand,
4141
}),
42-
rollupPlugins.commonjs(),
4342
rollupPlugins.nodeResolve(),
4443
rollupPlugins.inlineFs({verbose: false}),
4544
rollupPlugins.terser(),

clients/extension/scripts/popup.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*/
66
'use strict';
77

8-
const SettingsController = require('./settings-controller.js');
8+
import * as SettingsController from './settings-controller.js';
99

1010
const VIEWER_URL = 'https://googlechrome.github.io/lighthouse/viewer/';
1111
const optionsVisibleClass = 'main--options-visible';

clients/extension/scripts/settings-controller.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ function loadSettings() {
8989
});
9090
}
9191

92-
module.exports = {
92+
export {
9393
DEFAULT_CATEGORIES,
9494
STORAGE_KEYS,
9595
saveSettings,
File renamed without changes.

clients/test/extension/popup-test-pptr.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,11 @@
55
*/
66
'use strict';
77

8-
const path = require('path');
9-
const puppeteer = require('puppeteer-core');
10-
const {getChromePath} = require('chrome-launcher');
11-
const {DEFAULT_CATEGORIES, STORAGE_KEYS} =
12-
require('../../extension/scripts/settings-controller.js');
13-
const {LH_ROOT} = require('../../../root.js');
8+
import path from 'path';
9+
import puppeteer from 'puppeteer-core';
10+
import {getChromePath} from 'chrome-launcher';
11+
import {DEFAULT_CATEGORIES, STORAGE_KEYS} from '../../extension/scripts/settings-controller.js';
12+
import {LH_ROOT} from '../../../root.js';
1413

1514
const lighthouseExtensionPath = path.resolve(LH_ROOT, 'dist/extension-chrome');
1615

clients/test/extension/settings-controller-test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
*/
66
'use strict';
77

8-
const SettingsController = require('../../extension/scripts/settings-controller.js');
9-
const defaultConfig = require('../../../lighthouse-core/config/default-config.js');
10-
const format = require('../../../shared/localization/format.js');
8+
import * as SettingsController from '../../extension/scripts/settings-controller.js';
9+
import defaultConfig from '../../../lighthouse-core/config/default-config.js';
10+
import * as format from '../../../shared/localization/format.js';
1111

1212
describe('Lighthouse chrome extension SettingsController', () => {
1313
it('default categories should be correct', () => {

clients/test/lightrider/package.json

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)