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 npm module export #808

Merged
merged 3 commits into from
Jul 18, 2018
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
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"description": "Auth0 headless browser sdk",
"author": "Auth0",
"license": "MIT",
"main": "src/index.js",
"browser": "dist/auth0.min.js",
"module": "dist/auth0.min.esm.js",
"main": "dist/auth0.min.js",
"files": [
"src",
"plugins",
Expand Down Expand Up @@ -86,7 +86,7 @@
"rollup-plugin-replace": "^2.0.0",
"rollup-plugin-serve": "^0.4.2",
"rollup-plugin-sourcemaps": "^0.4.2",
"rollup-plugin-uglify": "^4.0.0",
"rollup-plugin-terser": "^1.0.1",
"selenium-webdriver": "^3.0.1",
"semver": "^5.5.0",
"sinon": "^1.17.6",
Expand Down
39 changes: 26 additions & 13 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const resolve = require('rollup-plugin-node-resolve');
const commonjs = require('rollup-plugin-commonjs');
const replace = require('rollup-plugin-replace');
const { uglify } = require('rollup-plugin-uglify');
const { terser } = require('rollup-plugin-terser');
const serve = require('rollup-plugin-serve');
const livereload = require('rollup-plugin-livereload');
const license = require('rollup-plugin-license');
Expand All @@ -26,7 +26,7 @@ const getPlugins = isProduction => {
'process.env.NODE_ENV': isProduction ? "'production'" : "'development'"
}),
isProduction &&
uglify({
terser({
compress: { warnings: false },
output: { comments: false },
mangle: false
Expand All @@ -42,17 +42,23 @@ const getPlugins = isProduction => {
];
};

export default [
//prod
const prodFiles = [
{
input: 'src/index.js',
output: {
name: 'auth0',
file: pkg.browser,
format: 'umd',
sourcemap: true,
exports: 'named'
},
output: [
{
name: 'auth0',
file: pkg.main,
format: 'umd',
sourcemap: true,
exports: 'named'
},
{
file: pkg.module,
format: 'es',
sourcemap: true
}
],
plugins: getPlugins(isProduction)
},
{
Expand All @@ -65,8 +71,9 @@ export default [
exports: 'default'
},
plugins: getPlugins(isProduction)
},
//dev
}
];
const devFiles = [
{
input: 'src/index.js',
output: {
Expand Down Expand Up @@ -99,3 +106,9 @@ export default [
plugins: getPlugins(false)
}
];

const finalFiles = [...devFiles];
if (isProduction) {
finalFiles.push(...prodFiles);
}
export default finalFiles;
38 changes: 25 additions & 13 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1251,7 +1251,7 @@ command-line-usage@^3.0.3, command-line-usage@^3.0.5:
table-layout "^0.3.0"
typical "^2.6.0"

commander@2.15.1, commander@~2.15.0:
commander@2.15.1:
version "2.15.1"
resolved "https://registry.yarnpkg.com/commander/-/commander-2.15.1.tgz#df46e867d0fc2aec66a34662b406a9ccafff5b0f"

Expand All @@ -1261,6 +1261,10 @@ commander@^2.9.0:
dependencies:
graceful-readlink ">= 1.0.0"

commander@~2.16.0:
version "2.16.0"
resolved "https://registry.yarnpkg.com/commander/-/commander-2.16.0.tgz#f16390593996ceb4f3eeb020b31d78528f7f8a50"

commenting@1.0.5:
version "1.0.5"
resolved "https://registry.yarnpkg.com/commenting/-/commenting-1.0.5.tgz#3104d542cac8a4f27b3d51438f4b80431fe4526b"
Expand Down Expand Up @@ -4300,12 +4304,12 @@ rollup-plugin-sourcemaps@^0.4.2:
rollup-pluginutils "^2.0.1"
source-map-resolve "^0.5.0"

rollup-plugin-uglify@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/rollup-plugin-uglify/-/rollup-plugin-uglify-4.0.0.tgz#6eb471738f1ce9ba7d9d4bc43b71cba02417c8fb"
rollup-plugin-terser@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/rollup-plugin-terser/-/rollup-plugin-terser-1.0.1.tgz#ba5f497cbc9aa38ba19d3ee2167c04ea3ed279af"
dependencies:
"@babel/code-frame" "^7.0.0-beta.47"
uglify-js "^3.3.25"
terser "^3.7.5"

rollup-pluginutils@^2.0.1, rollup-pluginutils@^2.2.0:
version "2.3.0"
Expand Down Expand Up @@ -4532,6 +4536,13 @@ source-map-support@^0.4.15:
dependencies:
source-map "^0.5.6"

source-map-support@~0.5.6:
version "0.5.6"
resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.6.tgz#4435cee46b1aab62b8e8610ce60f788091c51c13"
dependencies:
buffer-from "^1.0.0"
source-map "^0.6.0"

source-map-url@^0.4.0:
version "0.4.0"
resolved "https://registry.yarnpkg.com/source-map-url/-/source-map-url-0.4.0.tgz#3e935d7ddd73631b97659956d55128e87b5084a3"
Expand All @@ -4552,7 +4563,7 @@ source-map@^0.5.0, source-map@^0.5.3, source-map@^0.5.6, source-map@^0.5.7:
version "0.5.7"
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc"

source-map@^0.6.1, source-map@~0.6.1:
source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.1:
version "0.6.1"
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263"

Expand Down Expand Up @@ -4797,6 +4808,14 @@ temp-path@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/temp-path/-/temp-path-1.0.0.tgz#24b1543973ab442896d9ad367dd9cbdbfafe918b"

terser@^3.7.5:
version "3.8.0"
resolved "https://registry.yarnpkg.com/terser/-/terser-3.8.0.tgz#66a4f4f500d2c829faab840f318c49cc471d73ae"
dependencies:
commander "~2.16.0"
source-map "~0.6.1"
source-map-support "~0.5.6"

test-exclude@^4.2.0, test-exclude@^4.2.1:
version "4.2.2"
resolved "https://registry.yarnpkg.com/test-exclude/-/test-exclude-4.2.2.tgz#8b67aa8408f84afc225b06669e25c510f8582820"
Expand Down Expand Up @@ -4927,13 +4946,6 @@ uglify-js@^2.6:
uglify-to-browserify "~1.0.0"
yargs "~3.10.0"

uglify-js@^3.3.25:
version "3.4.0"
resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.4.0.tgz#796762282b5b5f0eafe7d5c8c708d1d7bd5ba11d"
dependencies:
commander "~2.15.0"
source-map "~0.6.1"

uglify-js@~2.3:
version "2.3.6"
resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-2.3.6.tgz#fa0984770b428b7a9b2a8058f46355d14fef211a"
Expand Down