Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Can't resolve 'fs' #544

Closed
Closed
@rossjs

Description

I'm assuming this is an issue with Webpack decision to no longer include Node polyfills in v5, but I can no longer get the code to build.

I'm using @craco/craco (v7.0.0) in order to load the wasm and have tried manually adding polyfills to craco.config.js but fs continues to be an issue. I suppose that makes sense, since I don't know how you could polyfill that module for the browser, though apparently it was working previously with that in there?

Anyway, here's my current craco.config.js file

const NodePolyfillPlugin = require('node-polyfill-webpack-plugin');
module.exports = {
 webpack: {
 plugins: [
 new NodePolyfillPlugin({
 includeAliases: ['path', 'crypto', 'stream', 'fs'],
 }),
 ],
 configure: {
 module: {
 rules: [{
 test: /\.wasm$/,
 type: 'javascript/auto',
 }],
 },
 },
 },
};

I've tried a few other workarounds but nothing's stuck. Any help would be greatly appreciated!

I'm on macOS Venture 13.2.1 and using Node.js v18.14.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /