Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 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
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
"mongoose": "^5.3.12",
"mysql": "^2.16.0",
"node-gyp": "^3.8.0",
"node-libs-browser": "^2.2.1",
"npm": "^6.13.4",
"oracledb": "^4.2.0",
"passport": "^0.4.0",
Expand Down Expand Up @@ -106,7 +107,7 @@
"vm2": "^3.6.6",
"vue": "^2.5.17",
"vue-server-renderer": "^2.5.17",
"webpack": "5.0.0-beta.28",
"webpack": "5.2.0",
"when": "^3.7.8"
}
}
10 changes: 10 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,20 @@ const terser = require("terser");
const tsconfigPaths = require("tsconfig-paths");
const { loadTsconfig } = require("tsconfig-paths/lib/tsconfig-loader");
const TsconfigPathsPlugin = require("tsconfig-paths-webpack-plugin");
const nodeLibsBrowser = require('node-libs-browser');
Comment thread
huozhi marked this conversation as resolved.
Outdated
const shebangRegEx = require('./utils/shebang');
const nccCacheDir = require("./utils/ncc-cache-dir");
const LicenseWebpackPlugin = require('license-webpack-plugin').LicenseWebpackPlugin;
const { version: nccVersion } = require('../package.json');

const nodeLibsFallbacks = Object.keys(nodeLibsBrowser)
.reduce((r, key) => {
if (nodeLibsBrowser[key] !== null) {
r[key] = nodeLibsBrowser[key];
}
return r;
}, {});

// support glob graceful-fs
fs.gracefulify(require("fs"));

Expand Down Expand Up @@ -203,6 +212,7 @@ module.exports = (
// webpack defaults to `module` and `main`, but that's
// not really what node.js supports, so we reset it
mainFields: ["main"],
fallback: nodeLibsFallbacks,
plugins: resolvePlugins
},
// https://github.com/vercel/ncc/pull/29#pullrequestreview-177152175
Expand Down
3 changes: 2 additions & 1 deletion test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ for (const unitTest of fs.readdirSync(`${__dirname}/unit`)) {
const actual = code
.trim()
// Windows support
.replace(/\r/g, "");
.replace(/\r/g, "")
.replace(/;+/g, ";");
try {
expect(actual).toBe(expected);
} catch (e) {
Expand Down
2 changes: 1 addition & 1 deletion test/watcher.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,4 +136,4 @@ it('Should support custom watch API', async () => {
console.time('Watched Build');
});
});
});
});
Loading