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

Fixup shebang loader order #196

Merged
merged 5 commits into from
Dec 31, 2018
Merged
Show file tree
Hide file tree
Changes from 3 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
13 changes: 7 additions & 6 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,6 @@ module.exports = (
},
module: {
rules: [
{
parser: { amd: false },
use: [{
loader: __dirname + "/loaders/shebang-loader.js"
}]
},
{
test: /\.node$/,
use: [{
Expand All @@ -142,6 +136,13 @@ module.exports = (
}
}
}]
},
{
parser: { amd: false },
test: /^(.(?!.*\.node$))*$/,
Copy link
Member

Choose a reason for hiding this comment

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

That's probably the regexp with the worst performance you could have chosen.

Try: exclude: /\.node$/

use: [{
loader: __dirname + "/loaders/shebang-loader.js"
}]
}
]
},
Expand Down
4 changes: 2 additions & 2 deletions test/unit/amd-disable/output.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ module.exports =
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(644);
/******/ return __webpack_require__(947);
/******/ })
/************************************************************************/
/******/ ({

/***/ 644:
/***/ 947:
/***/ (function() {

if (typeof define === 'function' && define.amd)
Expand Down
18 changes: 9 additions & 9 deletions test/unit/asset-fs-inline-path-enc-es-2/output.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,12 @@ module.exports =
/******/ runtime(__webpack_require__);
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(593);
/******/ return __webpack_require__(259);
/******/ })
/************************************************************************/
/******/ ({

/***/ 589:
/***/ (function(module) {

module.exports = require("path");

/***/ }),

/***/ 593:
/***/ 259:
/***/ (function(__unusedmodule, __webpack_exports__, __webpack_require__) {

"use strict";
Expand All @@ -62,6 +55,13 @@ console.log(fs__WEBPACK_IMPORTED_MODULE_0___default.a.readFileSync(__dirname + '

/***/ }),

/***/ 589:
/***/ (function(module) {

module.exports = require("path");

/***/ }),

/***/ 66:
/***/ (function(module) {

Expand Down
18 changes: 9 additions & 9 deletions test/unit/asset-fs-inline-path-enc-es-3/output.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,12 @@ module.exports =
/******/ runtime(__webpack_require__);
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(655);
/******/ return __webpack_require__(545);
/******/ })
/************************************************************************/
/******/ ({

/***/ 589:
/***/ (function(module) {

module.exports = require("path");

/***/ }),

/***/ 655:
/***/ 545:
/***/ (function(__unusedmodule, __webpack_exports__, __webpack_require__) {

"use strict";
Expand All @@ -62,6 +55,13 @@ console.log(fs__WEBPACK_IMPORTED_MODULE_0___default.a.readFileSync(__dirname + '

/***/ }),

/***/ 589:
/***/ (function(module) {

module.exports = require("path");

/***/ }),

/***/ 66:
/***/ (function(module) {

Expand Down
32 changes: 16 additions & 16 deletions test/unit/asset-fs-inline-path-enc-es-4/output.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,26 @@ module.exports =
/******/ runtime(__webpack_require__);
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(428);
/******/ return __webpack_require__(736);
/******/ })
/************************************************************************/
/******/ ({

/***/ 428:
/***/ 589:
/***/ (function(module) {

module.exports = require("path");

/***/ }),

/***/ 66:
/***/ (function(module) {

module.exports = require("fs");

/***/ }),

/***/ 736:
/***/ (function(__unusedmodule, __webpack_exports__, __webpack_require__) {

"use strict";
Expand All @@ -55,20 +69,6 @@ const join = path__WEBPACK_IMPORTED_MODULE_1__["join"];

console.log(fs__WEBPACK_IMPORTED_MODULE_0___default.a.readFileSync(__dirname + '/asset.txt', 'utf8'));

/***/ }),

/***/ 589:
/***/ (function(module) {

module.exports = require("path");

/***/ }),

/***/ 66:
/***/ (function(module) {

module.exports = require("fs");

/***/ })

/******/ },
Expand Down
4 changes: 2 additions & 2 deletions test/unit/asset-fs-inline-path-enc-es/output.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ module.exports =
/******/ runtime(__webpack_require__);
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(755);
/******/ return __webpack_require__(885);
/******/ })
/************************************************************************/
/******/ ({
Expand All @@ -53,7 +53,7 @@ module.exports = require("fs");

/***/ }),

/***/ 755:
/***/ 885:
/***/ (function(__unusedmodule, __webpack_exports__, __webpack_require__) {

"use strict";
Expand Down
18 changes: 9 additions & 9 deletions test/unit/asset-fs-inline-path-enc/output.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ module.exports =
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(627);
/******/ return __webpack_require__(660);
/******/ })
/************************************************************************/
/******/ ({
Expand All @@ -44,19 +44,19 @@ module.exports = require("path");

/***/ }),

/***/ 627:
/***/ (function(__unusedmodule, __unusedexports, __webpack_require__) {
/***/ 66:
/***/ (function(module) {

const fs = __webpack_require__(66);
const { join } = __webpack_require__(589);
console.log(fs.readFileSync(__dirname + '/asset.txt', 'utf8'));
module.exports = require("fs");

/***/ }),

/***/ 66:
/***/ (function(module) {
/***/ 660:
/***/ (function(__unusedmodule, __unusedexports, __webpack_require__) {

module.exports = require("fs");
const fs = __webpack_require__(66);
const { join } = __webpack_require__(589);
console.log(fs.readFileSync(__dirname + '/asset.txt', 'utf8'));

/***/ })

Expand Down
4 changes: 2 additions & 2 deletions test/unit/asset-fs-inline-path-shadow/output.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ module.exports =
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(833);
/******/ return __webpack_require__(711);
/******/ })
/************************************************************************/
/******/ ({
Expand All @@ -51,7 +51,7 @@ module.exports = require("fs");

/***/ }),

/***/ 833:
/***/ 711:
/***/ (function(__unusedmodule, __unusedexports, __webpack_require__) {

const fs = __webpack_require__(66);
Expand Down
18 changes: 9 additions & 9 deletions test/unit/asset-fs-inlining-multi/output.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,25 +32,25 @@ module.exports =
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(860);
/******/ return __webpack_require__(619);
/******/ })
/************************************************************************/
/******/ ({

/***/ 66:
/***/ (function(module) {

module.exports = require("fs");

/***/ }),

/***/ 860:
/***/ 619:
/***/ (function(__unusedmodule, __unusedexports, __webpack_require__) {

const fs = __webpack_require__(66);
console.log(fs.readFileSync(__dirname + '/asset.txt'));
console.log(fs.readFileSync(__dirname + '/asset1.txt'));

/***/ }),

/***/ 66:
/***/ (function(module) {

module.exports = require("fs");

/***/ })

/******/ });
16 changes: 8 additions & 8 deletions test/unit/asset-fs-inlining/output.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,23 +32,23 @@ module.exports =
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(958);
/******/ return __webpack_require__(477);
/******/ })
/************************************************************************/
/******/ ({

/***/ 66:
/***/ (function(module) {
/***/ 477:
/***/ (function(__unusedmodule, __unusedexports, __webpack_require__) {

module.exports = require("fs");
const fs = __webpack_require__(66);
console.log(fs.readFileSync(__dirname + '/asset.txt'));

/***/ }),

/***/ 958:
/***/ (function(__unusedmodule, __unusedexports, __webpack_require__) {
/***/ 66:
/***/ (function(module) {

const fs = __webpack_require__(66);
console.log(fs.readFileSync(__dirname + '/asset.txt'));
module.exports = require("fs");

/***/ })

Expand Down
4 changes: 2 additions & 2 deletions test/unit/asset-package-json/output.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ module.exports =
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(556);
/******/ return __webpack_require__(540);
/******/ })
/************************************************************************/
/******/ ({

/***/ 556:
/***/ 540:
/***/ (function(__unusedmodule, __unusedexports, __webpack_require__) {

const path = __webpack_require__(589);
Expand Down
24 changes: 12 additions & 12 deletions test/unit/browserify/output.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,34 +32,34 @@ module.exports =
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(681);
/******/ return __webpack_require__(241);
/******/ })
/************************************************************************/
/******/ ({

/***/ 429:
/***/ 193:
/***/ (function(module) {

module.exports = 'dep2';

/***/ }),

/***/ 475:
/***/ (function(module) {

module.exports = 'dep1';

/***/ }),

/***/ 681:
/***/ 241:
/***/ (function(module, __unusedexports, __webpack_require__) {

var require;var require;(function(f){if(true){module.exports=f()}else { var g; }})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return require(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
module.exports = [require("./dep1"), require("./dep2")];
},{"./dep1": undefined, "./dep2": undefined}]},{"./dep1": { exports: __webpack_require__(475) },
"./dep2": { exports: __webpack_require__(429) }},[1])(1)
},{"./dep1": undefined, "./dep2": undefined}]},{"./dep1": { exports: __webpack_require__(452) },
"./dep2": { exports: __webpack_require__(193) }},[1])(1)
});

/***/ }),

/***/ 452:
/***/ (function(module) {

module.exports = 'dep1';

/***/ })

/******/ });
4 changes: 2 additions & 2 deletions test/unit/dirname-len/output.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ module.exports =
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(62);
/******/ return __webpack_require__(533);
/******/ })
/************************************************************************/
/******/ ({

/***/ 62:
/***/ 533:
/***/ (function() {

console.log(function (a, b) {
Expand Down
4 changes: 2 additions & 2 deletions test/unit/require-main/output.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ module.exports =
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(535);
/******/ return __webpack_require__(635);
/******/ })
/************************************************************************/
/******/ ({

/***/ 535:
/***/ 635:
/***/ (function() {

console.log(require.main.filename);
Expand Down
Loading