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

Cannot compile with webpack #10

Open
viebel opened this issue Oct 22, 2021 · 2 comments
Open

Cannot compile with webpack #10

viebel opened this issue Oct 22, 2021 · 2 comments

Comments

@viebel
Copy link

viebel commented Oct 22, 2021

Here is my webpack.config.js

const path = require('path');

module.exports = {
  entry: './src/index.js',
  output: {
    filename: 'main.js',
    path: path.resolve(__dirname, 'dist'),
  },
};

Here is my src/index.js

Here is my src/index.js

import cue, { memfs } from 'cuelang-js'

memfs.writeFileSync('/your.cue', 'hello: "world"');
const result = cue('export', ['/your.cue'], {"--out": "json"})

Here is my package.json

{
  "name": "node",
  "version": "1.0.0",
  "description": "",
  "main": "cue.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "webpack": "^5.59.1",
    "webpack-cli": "^4.9.1"
  },
  "dependencies": {
    "cuelang-js": "^1.3.1",
    "lodash": "^4.17.21"
  }
}

Here is how I am trying to build:

npx webpack

And here is the error I am getting:

assets by status 146 KiB [cached] 1 asset
runtime modules 1010 bytes 5 modules
modules by path ../node_modules/ 188 KiB 19 modules
modules by path ./ 169 KiB
  modules by path ./node_modules/memfs/lib/ 127 KiB 14 modules
  modules by path ./node_modules/cuelang-js/build/ 24.6 KiB 3 modules
  modules by path ./node_modules/fs-monkey/lib/ 2.4 KiB
    ./node_modules/fs-monkey/lib/util/lists.js 1.31 KiB [built] [code generated]
    ./node_modules/fs-monkey/lib/correctPath.js 1.09 KiB [built] [code generated]
  ./src/index.js 156 bytes [built] [code generated]
  ./node_modules/events/events.js 14.5 KiB [built] [code generated]

WARNING in ./node_modules/cuelang-js/build/wasm_exec.js 24:25-32
Critical dependency: require function is used in a way in which dependencies cannot be statically extracted
 @ ./node_modules/cuelang-js/build/index.js 14:0-22
 @ ./src/index.js 1:0-39 3:0-19 4:15-18

WARNING in configuration
The 'mode' option has not been set, webpack will fallback to 'production' for this value.
Set 'mode' option to 'development' or 'production' to enable defaults for each environment.
You can also set it to 'none' to disable any default behavior. Learn more: https://webpack.js.org/configuration/mode/

1 warning has detailed information that is not shown.
Use 'stats.errorDetails: true' resp. '--stats-error-details' to show it.

ERROR in ./node_modules/cuelang-js/build/index.js 13:13-28
Module not found: Error: Can't resolve 'path' in '/home/viebel/prj/data-oriented-programming-book/code/node/node_modules/cuelang-js/build'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
	- add a fallback 'resolve.fallback: { "path": require.resolve("path-browserify") }'
	- install 'path-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
	resolve.fallback: { "path": false }
 @ ./src/index.js 1:0-39 3:0-19 4:15-18

ERROR in ./node_modules/cuelang-js/build/index.js 15:15-28
Module not found: Error: Can't resolve 'fs' in '/home/viebel/prj/data-oriented-programming-book/code/node/node_modules/cuelang-js/build'
 @ ./src/index.js 1:0-39 3:0-19 4:15-18

ERROR in ./node_modules/cuelang-js/build/wasm_exec.js 27:19-32
Module not found: Error: Can't resolve 'fs' in '/home/viebel/prj/data-oriented-programming-book/code/node/node_modules/cuelang-js/build'
 @ ./node_modules/cuelang-js/build/index.js 14:0-22
 @ ./src/index.js 1:0-39 3:0-19 4:15-18

ERROR in ./node_modules/cuelang-js/build/wasm_exec.js 52:27-44
Module not found: Error: Can't resolve 'crypto' in '/home/viebel/prj/data-oriented-programming-book/code/node/node_modules/cuelang-js/build'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
	- add a fallback 'resolve.fallback: { "crypto": require.resolve("crypto-browserify") }'
	- install 'crypto-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
	resolve.fallback: { "crypto": false }
 @ ./node_modules/cuelang-js/build/index.js 14:0-22
 @ ./src/index.js 1:0-39 3:0-19 4:15-18

ERROR in ./node_modules/cuelang-js/build/wasm_exec.js 471:41-61
Module not found: Error: Can't resolve 'os' in '/home/viebel/prj/data-oriented-programming-book/code/node/node_modules/cuelang-js/build'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
	- add a fallback 'resolve.fallback: { "os": require.resolve("os-browserify/browser") }'
	- install 'os-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
	resolve.fallback: { "os": false }
 @ ./node_modules/cuelang-js/build/index.js 14:0-22
 @ ./src/index.js 1:0-39 3:0-19 4:15-18

ERROR in ./node_modules/memfs/lib/volume.js 28:17-32
Module not found: Error: Can't resolve 'path' in '/home/viebel/prj/data-oriented-programming-book/code/node/node_modules/memfs/lib'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
	- add a fallback 'resolve.fallback: { "path": require.resolve("path-browserify") }'
	- install 'path-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
	resolve.fallback: { "path": false }
 @ ./node_modules/memfs/lib/index.js 17:15-34
 @ ./node_modules/cuelang-js/build/index.js 16:16-32
 @ ./src/index.js 1:0-39 3:0-19 4:15-18

ERROR in ./node_modules/memfs/lib/volume.js 36:15-32
Module not found: Error: Can't resolve 'stream' in '/home/viebel/prj/data-oriented-programming-book/code/node/node_modules/memfs/lib'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
	- add a fallback 'resolve.fallback: { "stream": require.resolve("stream-browserify") }'
	- install 'stream-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
	resolve.fallback: { "stream": false }
 @ ./node_modules/memfs/lib/index.js 17:15-34
 @ ./node_modules/cuelang-js/build/index.js 16:16-32
 @ ./src/index.js 1:0-39 3:0-19 4:15-18

7 errors have detailed information that is not shown.
Use 'stats.errorDetails: true' resp. '--stats-error-details' to show it.

webpack 5.59.1 compiled with 7 errors and 2 warnings in 2557 ms
npm ERR! code 1
npm ERR! path /home/viebel/prj/data-oriented-programming-book/code/node
npm ERR! command failed
npm ERR! command sh -c webpack

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/viebel/.npm/_logs/2021-10-22T14_40_24_826Z-debug.log
@codewithcheese
Copy link
Contributor

@viebel did you solve this?

@viebel
Copy link
Author

viebel commented Feb 1, 2022

No

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants