Skip to content

fix: output umd build for main key #19

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

Merged
merged 7 commits into from
Mar 19, 2020
Merged
Show file tree
Hide file tree
Changes from 5 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
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@github/remote-input-element",
"version": "0.2.0",
"description": "An input element that sends its value to a server endpoint and renders the response body.",
"main": "dist/index.js",
"main": "dist/umd/index.js",
"module": "dist/index.js",
"types": "dist/index.d.ts",
"license": "MIT",
Expand All @@ -14,7 +14,7 @@
"clean": "rm -rf dist",
"lint": "github-lint",
"prebuild": "npm run clean && npm run lint",
"build": "tsc",
"build": "tsc --outDir dist/umd --module umd && tsc",
"pretest": "npm run build",
"test": "karma start test/karma.config.js",
"prepublishOnly": "npm run build",
Expand Down
4 changes: 4 additions & 0 deletions test/bootstrap.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// Stub out CommonJS for tests
window.module = {exports: {}}
window.exports = module.exports
window.require = Function.prototype
8 changes: 1 addition & 7 deletions test/karma.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,7 @@ function reply(request, response, next) {
module.exports = function(config) {
config.set({
frameworks: ['mocha', 'chai'],
files: [
{
pattern: '../dist/index.js',
type: 'module'
},
'test.js'
],
files: ['bootstrap.js', '../dist/umd/index.js', 'test.js'],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bootstrap.js seems like an over-complication in comparison to loading the native module. Can we keep the test using the module output here?

reporters: ['mocha'],
port: 9876,
colors: true,
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"compilerOptions": {
"module": "esnext",
"target": "es2018",
"target": "es2017",
"lib": ["es2018", "dom"],
"strict": true,
"declaration": true,
"outDir": "dist",
Expand Down