Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
681cd8c
fix(commonjs): attach correct plugin meta-data to commonjs modules (#…
lukastaegert Sep 21, 2021
f55ba96
feat(commonjs): reimplement dynamic import handling (requires Node 12…
lukastaegert Oct 28, 2021
003845f
feat(commonjs): add strictRequires option to wrap modules (#1038)
lukastaegert Nov 6, 2021
771ef4a
feat(commonjs): automatically wrap cyclic modules (#1038)
lukastaegert Nov 9, 2021
aae44a2
feat(commonjs): Infer type for unidentified modules (#1038)
lukastaegert Nov 12, 2021
1054074
feat(commonjs): make namespace callable when requiring ESM with funct…
lukastaegert Nov 12, 2021
4424686
feat(commonjs): limit ignoreTryCatch to external requires (#1038)
lukastaegert Nov 19, 2021
a9ed479
feat(commonjs): auto-detect conditional requires (#1038)
lukastaegert Nov 20, 2021
42e7196
feat(commonjs): add dynamicRequireRoot option (#1038)
lukastaegert Nov 21, 2021
06a74ae
feat(commonjs): throw for dynamic requires from outside the configure…
lukastaegert Nov 22, 2021
3cdad21
refactor(commonjs): deconflict helpers only once globals are known (#…
lukastaegert Nov 22, 2021
3b28947
feat(commonjs): expose plugin version (#1038)
lukastaegert Nov 24, 2021
a66d253
fix(commonjs): do not transform "typeof exports" for mixed modules (#…
lukastaegert Dec 2, 2021
29074f4
fix(commonjs): inject module name into dynamic require function (#1038)
lukastaegert Dec 14, 2021
804eb8e
fix(commonjs): validate node-resolve peer version (#1038)
lukastaegert Dec 14, 2021
d01238f
fix(commonjs): use correct version and add package exports (#1038)
lukastaegert Dec 14, 2021
017ea90
fix(commonjs): proxy all entries to not break legacy polyfill plugins…
lukastaegert Jan 14, 2022
a521f47
fix(commonjs): add heuristic to deoptimize requires after calling imp…
lukastaegert Feb 7, 2022
368f9c8
fix(commonjs): handle external dependencies when using the cache (#1038)
lukastaegert Feb 24, 2022
e5f1abd
fix(commonjs): Do not change semantics when removing requires in if s…
lukastaegert Apr 3, 2022
e2f26a4
fix(commonjs): Warn when plugins do not pass options to resolveId (#1…
lukastaegert Apr 18, 2022
5b3bd05
fix(commonjs): support CJS modules re-exporting transpiled ESM module…
fwouts Apr 24, 2022
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
Prev Previous commit
Next Next commit
fix(commonjs): use correct version and add package exports (#1038)
  • Loading branch information
lukastaegert committed Apr 24, 2022
commit d01238fb5effc0b461c6285b99fa688c551d8cf8
8 changes: 6 additions & 2 deletions packages/commonjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,12 @@
"author": "Rich Harris <[email protected]>",
"homepage": "https://github.com/rollup/plugins/tree/master/packages/commonjs/#readme",
"bugs": "https://github.com/rollup/plugins/issues",
"main": "dist/index.js",
"module": "dist/index.es.js",
"main": "./dist/cjs/index.js",
"module": "./dist/es/index.js",
"exports": {
"require": "./dist/cjs/index.js",
"import": "./dist/es/index.js"
},
"engines": {
"node": ">= 12.0.0"
},
Expand Down
3 changes: 3 additions & 0 deletions packages/commonjs/rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import json from '@rollup/plugin-json';

import { emitModulePackageFile } from '../../shared/rollup.config';

import pkg from './package.json';

export default {
Expand All @@ -10,6 +12,7 @@ export default {
{
file: pkg.module,
format: 'es',
plugins: [emitModulePackageFile()],
sourcemap: true
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const { workerData, parentPort } = require('worker_threads');

const { rollup } = require('rollup');

const commonjs = require('../../../../dist/index');
const commonjs = require('../../../..');
const { getCodeFromBundle } = require('../../../helpers/util');

generateCode(workerData);
Expand Down
2 changes: 1 addition & 1 deletion packages/commonjs/test/helpers/util.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const path = require('path');

const commonjsPlugin = require('../../dist/index');
const commonjsPlugin = require('../..');

function commonjs(options) {
delete require.cache[require.resolve('../..')];
Expand Down
2 changes: 1 addition & 1 deletion packages/commonjs/test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ test('does not warn even if the ES module does not export "default"', async (t)
test('compiles with cache', async (t) => {
// specific commonjs require() to ensure same instance is used
// eslint-disable-next-line global-require
const commonjsInstance = require('../dist/index');
const commonjsInstance = require('..');

const bundle = await rollup({
input: 'fixtures/function/index/main.js',
Expand Down