elm-community/elm-webpack-loader

Primordials not defined

toastal opened this issue · 9 comments

const { Math, Object, Reflect } = primordials;
                                  ^

ReferenceError: primordials is not defined
    at fs.js:27:35
    at req_ (PROJECT/node_modules/natives/index.js:143:24)
    at Object.req [as require] (PROJECT/node_modules/natives/index.js:55:10)
    at Object.<anonymous> (PROJECT/node_modules/unzip/node_modules/graceful-fs/fs.js:1:37)
    at Module._compile (internal/modules/cjs/loader.js:759:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:770:10)
    at Module.load (internal/modules/cjs/loader.js:628:32)
    at Function.Module._load (internal/modules/cjs/loader.js:555:12)
    at Module.require (internal/modules/cjs/loader.js:666:19)
    at require (internal/modules/cjs/helpers.js:16:16)

    at ChildProcess.<anonymous> (PROJECT/node_modules/node-elm-compiler/dist/index.js:131:35)
    at ChildProcess.emit (events.js:196:13)
    at maybeClose (internal/child_process.js:1000:16)
    at Socket.<anonymous> (internal/child_process.js:405:11)
    at Socket.emit (events.js:196:13)
    at Pipe.<anonymous> (net.js:586:12)

When moving to Node v12, I got this error.

What fails is installing Elm. You get this everywhere. Stay on an older version of nodejs.

me too, Node v12, the same

Any chance that PR173 can get merged? Thanks

Confirmed to no longer being an issue with latest release of webpack loader

I am still having the same problem after I took it to "elm-webpack-loader": "^6.0.0",.

Have you tried specifying "elm": "0.19.0-no-deps" in package.json?

I'm having the problem too with 6.0.0. Tried specifying the above in package.json like you said.

Edit:

To fix, also had to npm uninstall -g npm.

It works in all of our elm projects at work. Here is an example package.json that works. Make sure you've updated the lock file.

{
  "name": "form-frontend",
  "app_version": 33,
  "scripts": {
    "dev": "webpack-dev-server --hot --port 3000 --config webpack.dev.js",
    "build:prod:no": "webpack --env.LANG_NO --config webpack.prod.js",
    "build:prod:en": "webpack --env.LANG_EN --env.KEEP_BUILD_FOLDER --config webpack.prod.js",
    "build:prod": "npm run language:no && npm run build:prod:no && npm run language:en && npm run build:prod:en",
    "language:no": "(rm -r elm-stuff/0.19* | true) && elm-i18n-switch --yes -l No",
    "language:en": "(rm -r elm-stuff/0.19* | true) && elm-i18n-switch --yes -l En",
    "graphql:update": "elm-graphql https://test1.form.cloud.vy.no/graphql --base Schema --scalar-codecs CustomScalarCodecs",
    "postinstall": "elm-git-install"
  },
  "dependencies": {},
  "devDependencies": {
    "@dillonkearns/elm-graphql": "^3.6.2",
    "clean-webpack-plugin": "^1.0.1",
    "copy-webpack-plugin": "^4.6.0",
    "elm": "^0.19.0-no-deps",
    "elm-git-install": "0.1.2",
    "elm-hot-webpack-loader": "^1.1.1",
    "elm-i18n": "^1.0.2",
    "elm-minify": "^2.0.4",
    "elm-webpack-loader": "^6.0.0",
    "html-webpack-plugin": "^3.2.0",
    "webpack": "^4.39.1",
    "webpack-cli": "^3.3.6",
    "webpack-dev-server": "^3.7.2",
    "webpack-merge": "^4.2.1"
  }
}

Node v12 seems to work fine after updating all my dependencies to stuff for Elm v0.19.1