0

I just have installed the newest version of angular (5.2.0) and CLI 1.6.6. I did eject command and get webpack.config.js with full scripts path:

"plugins": [
    new NoEmitOnErrorsPlugin(),
    new ScriptsWebpackPlugin({
      "name": "scripts",
      "sourceMap": true,
      "filename": "scripts.bundle.js",
      "scripts": [
        "D:\\GitProjects\\Product\\ProjectName\\node_modules\\jquery\\dist\\jquery.min.js",
        "D:\\GitProjects\\Product\\ProjectName\\node_modules\\tv4\\tv4.js"
      ],
      "basePath": "D:\\GitProjects\\Product\\ProjectName"
    }),

Why does paths are absolute, should not be relative as it was until now ?

2 Answers 2

2

It is a known bug. Well, since "eject" is a one-time use command, the best thing you can do is changing the paths manually (or write a simple script for it).

Sign up to request clarification or add additional context in comments.

1 Comment

Yes, that was for alias, I had the same problem from with previous version, and update new one. With new one no more "alias problem" but another problem with scripts absolute path.
0

Solution is to replace all absolute paths with relative. We can use process.cwd() for that. process.cwd() returns the current working directory

"plugins": [
    new NoEmitOnErrorsPlugin(),
    new ScriptsWebpackPlugin({
      "name": "scripts",
      "sourceMap": true,
      "filename": "scripts.bundle.js",
      "scripts": [
        path.join(process.cwd(), "node_modules\\jquery\\dist\\jquery.min.js");,
        path.join(process.cwd(), "node_modules\\tv4\\tv4.js");
      ],
      "basePath": process.cwd()
    }),

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.