-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix electron webpack samples (#6864)
The electron webpack samples' transforms weren't updated when we changed to .cjs extensions which breaks native module imports (node extensions). This PR addresses by adding .cjs to the list of files to transform
- Loading branch information
Showing
5 changed files
with
66,246 additions
and
74,750 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,31 @@ | ||
import type { ModuleOptions } from 'webpack'; | ||
import type { ModuleOptions } from "webpack"; | ||
|
||
export const rules: Required<ModuleOptions>['rules'] = [ | ||
// Add support for native node modules | ||
{ | ||
// We're specifying native_modules in the test because the asset relocator loader generates a | ||
// "fake" .node file which is really a cjs file. | ||
test: /native_modules\/.+\.node$/, | ||
use: 'node-loader', | ||
}, | ||
{ | ||
test: /\.(m?js|node)$/, | ||
parser: { amd: false }, | ||
use: { | ||
loader: '@vercel/webpack-asset-relocator-loader', | ||
options: { | ||
outputAssetBase: 'native_modules', | ||
}, | ||
export const rules: Required<ModuleOptions>["rules"] = [ | ||
// Add support for native node modules | ||
{ | ||
// We're specifying native_modules in the test because the asset relocator loader generates a | ||
// "fake" .node file which is really a cjs file. | ||
test: /native_modules\/.+\.node$/, | ||
use: "node-loader", | ||
}, | ||
}, | ||
{ | ||
test: /\.tsx?$/, | ||
exclude: /(node_modules|\.webpack)/, | ||
use: { | ||
loader: 'ts-loader', | ||
options: { | ||
transpileOnly: true, | ||
}, | ||
{ | ||
test: /\.([m|c]?js|node)$/, | ||
parser: { amd: false }, | ||
use: { | ||
loader: "@vercel/webpack-asset-relocator-loader", | ||
options: { | ||
outputAssetBase: "native_modules", | ||
}, | ||
}, | ||
}, | ||
{ | ||
test: /\.tsx?$/, | ||
exclude: /(node_modules|\.webpack)/, | ||
use: { | ||
loader: "ts-loader", | ||
options: { | ||
transpileOnly: true, | ||
}, | ||
}, | ||
}, | ||
}, | ||
]; |
Oops, something went wrong.