Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
module: move cjs type check behind flag
  • Loading branch information
guybedford committed Sep 27, 2019
commit 68498665fc512a77e96155b53da2faa094adebdb
2 changes: 1 addition & 1 deletion lib/internal/modules/cjs/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -953,7 +953,7 @@ Module.prototype._compile = function(content, filename) {

// Native extension for .js
Module._extensions['.js'] = function(module, filename) {
if (filename.endsWith('.js')) {
if (filename.endsWith('.js') && experimentalModules) {
Comment thread
guybedford marked this conversation as resolved.
Outdated
const pkg = readPackageScope(filename);
if (pkg && pkg.type === 'module') {
throw new ERR_REQUIRE_ESM(filename);
Expand Down
1 change: 1 addition & 0 deletions test/es-module/test-esm-type-flag-errors.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Flags: --experimental-modules
'use strict';
const common = require('../common');
const assert = require('assert');
Expand Down