From d7faab61cab5e2b19fa0153202c7dac13c5055e9 Mon Sep 17 00:00:00 2001 From: Christian Pillsbury Date: Mon, 8 Nov 2021 08:04:06 -0600 Subject: [PATCH] build/esm-package: update media-chrome to use type:module. Update CJS modules to have expected cjs extension. Update build script references. --- package.json | 5 +++-- ...on.config.js => snowpack.common.config.cjs | 0 snowpack.config.cjs | 20 +++++++++++++++++++ ...k.dev.config.js => snowpack.dev.config.cjs | 2 +- ...prod.config.js => snowpack.prod.config.cjs | 2 +- 5 files changed, 25 insertions(+), 4 deletions(-) rename snowpack.common.config.js => snowpack.common.config.cjs (100%) create mode 100644 snowpack.config.cjs rename snowpack.dev.config.js => snowpack.dev.config.cjs (94%) rename snowpack.prod.config.js => snowpack.prod.config.cjs (91%) diff --git a/package.json b/package.json index bda34a20d..8e25b94ec 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,7 @@ "version": "0.3.2", "description": "Custom elements (web components) for making audio and video player controls that look great in your website or app.", "main": "dist/index.js", + "type": "module", "files": [ "dist/*", "README.md", @@ -10,8 +11,8 @@ ], "scripts": { "clean": "rimraf dist", - "build": "snowpack build --config snowpack.prod.config.js", - "dev": "snowpack dev --config snowpack.dev.config.js", + "build": "snowpack build --config snowpack.prod.config.cjs", + "dev": "snowpack dev --config snowpack.dev.config.cjs", "start": "yarn dev", "test": "web-test-runner --coverage", "publish-patch": "yarn run build && np patch --no-tests --any-branch" diff --git a/snowpack.common.config.js b/snowpack.common.config.cjs similarity index 100% rename from snowpack.common.config.js rename to snowpack.common.config.cjs diff --git a/snowpack.config.cjs b/snowpack.config.cjs new file mode 100644 index 000000000..87ab6487a --- /dev/null +++ b/snowpack.config.cjs @@ -0,0 +1,20 @@ +// Snowpack Configuration File +// See all supported options: https://www.snowpack.dev/reference/configuration + +/** @type {import("snowpack").SnowpackUserConfig } */ +module.exports = { + extends: './snowpack.dev.config.cjs', + mount: { + '__tests__/setup': { url: '/dist/test-setup' }, + }, + packageOptions: { + /* ... */ + polyfillNode: true, + }, + testOptions: { + files: ['__tests__/@(unit|integration)/**/*.@(test|spec).js', '__tests__/setup/**/*'], + }, + alias: { + 'graceful-fs': 'memfs', + }, +}; diff --git a/snowpack.dev.config.js b/snowpack.dev.config.cjs similarity index 94% rename from snowpack.dev.config.js rename to snowpack.dev.config.cjs index 9dbc29cef..085c14d84 100644 --- a/snowpack.dev.config.js +++ b/snowpack.dev.config.cjs @@ -3,7 +3,7 @@ /** @type {import("snowpack").SnowpackUserConfig } */ module.exports = { - extends: './snowpack.common.config.js', + extends: './snowpack.common.config.cjs', mount: { 'src/js': { url: '/dist' }, // Mount "public" to the root URL path ("/*") and serve files with zero transformations: diff --git a/snowpack.prod.config.js b/snowpack.prod.config.cjs similarity index 91% rename from snowpack.prod.config.js rename to snowpack.prod.config.cjs index c57a37210..af71132b4 100644 --- a/snowpack.prod.config.js +++ b/snowpack.prod.config.cjs @@ -3,7 +3,7 @@ /** @type {import("snowpack").SnowpackUserConfig } */ module.exports = { - extends: './snowpack.common.config.js', + extends: './snowpack.common.config.cjs', mount: { 'src/js': { url: '/' }, },