symfony / webpack-encore

A simple but powerful API for processing & compiling assets built around Webpack
https://symfony.com/doc/current/frontend.html
MIT License
2.23k stars 199 forks source link

Module build failed #1052

Open skynetjam opened 3 years ago

skynetjam commented 3 years ago

I m not able to run it is giving me this error ERROR

 error  in ./assets/app.tsx                                                                                                                                                                     
Module build failed (from ./node_modules/ts-loader/index.js):
TypeError: Cannot read property 'PROCESS_ASSETS_STAGE_ADDITIONAL' of undefined
    at makeAssetsCallback (node_modules\ts-loader\dist\instances.js:201:40)

Please check my webpack.config

var Encore = require('@symfony/webpack-encore');

Encore

// Build
    .setOutputPath('public/build/')
    .setPublicPath('/build')
    .cleanupOutputBeforeBuild()
    .enableSourceMaps(!Encore.isProduction())
    .enableVersioning(Encore.isProduction())

    // SCSS
    .addStyleEntry('css/app', './assets/app.css')
    //.enableSassLoader()

    // Typescript + React
    .addEntry('app', './assets/app.tsx')
    .enableReactPreset()
    .enableTypeScriptLoader()
    .splitEntryChunks()
    .enableSingleRuntimeChunk()
    .configureBabelPresetEnv((config) => {
        config.useBuiltIns = 'usage';
        config.corejs = 3;
    })
    .enableBuildNotifications();

module.exports = Encore.getWebpackConfig();

my package.json

{
  "name": "Appointmento",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev-server": "encore dev-server",
    "dev": "encore dev",
    "watch": "encore dev --watch",
    "build": "encore production"
  },
  "dependencies": {
    "@material-ui/core": "^4.11.0",
    "@material-ui/icons": "^4.11.2",
    "@material-ui/lab": "^4.0.0-alpha.58",
    "@testing-library/jest-dom": "^5.11.9",
    "@testing-library/react": "^11.2.5",
    "@testing-library/user-event": "^13.0.6",
    "@types/jest": "^26.0.21",
    "@types/node": "^16.11.1",
    "@types/react": "^17.0.3",
    "@types/react-calendar": "^3.4.0",
    "@types/react-dom": "^17.0.10",
    "babel-preset-react": "^6.24.1",
    "body-parser": "^1.19.0",
    "clsx": "^1.1.1",
    "eslint": "^8.0.1",
    "formik": "^2.2.6",
    "moment-timezone": "^0.5.33",
    "react": "^17.0.1",
    "react-calendar": "^3.4.0",
    "react-dom": "^17.0.1",
    "react-router-dom": "^5.2.0",
    "react-scripts": "^4.0.0",
    "socket.io-client": "^4.0.1",
    "ts-loader": "^9.2.6",
    "typescript": "^4.2.3",
    "use-debounce": "^6.0.0",
    "yup": "^0.32.8"
  },
  "devDependencies": {
    "@symfony/webpack-encore": "^1.6.1",
    "@types/react-router-dom": "^5.1.7",
    "@typescript-eslint/eslint-plugin": "^4.23.0",
    "@typescript-eslint/parser": "^4.23.0",
    "eslint-config-prettier": "^8.3.0",
    "eslint-plugin-prettier": "^3.4.0",
    "eslint-plugin-react-hooks": "^4.2.0",
    "husky": "^5.1.3",
    "lint-staged": "^10.5.4",
    "prettier": "^2.3.0",
    "webpack-notifier": "^1.14.1"
  }
}

Can anyone please help me with this

pdfairwalter commented 2 years ago

@skynetjam I have the same issue, were you able to solve this?

carsonbot commented 18 hours ago

Thank you for this issue. There has not been a lot of activity here for a while. Has this been resolved?