metal / metal.js

Build UI components in a solid, flexible way
http://metaljs.com
Other
229 stars 59 forks source link

Namespace "goog.string" already declared. #370

Closed ssmith353 closed 6 years ago

ssmith353 commented 6 years ago

I'm not sure what recently changed, but even after clearing my node_modules folder, I can't run my app, and always get this error in the console.

Uncaught Error: Namespace "goog.string" already declared.
    at Object.goog.provide (bundle.nocsf.js?browserId=other&minifierType=js&languageId=en_US&b=7010&t=1522922183652:180)
    at bundle.nocsf.js?browserId=other&minifierType=js&languageId=en_US&b=7010&t=1522922183652:181
    at Object.<anonymous> (bundle.nocsf.js?browserId=other&minifierType=js&languageId=en_US&b=7010&t=1522922183652:181)
    at Object.<anonymous> (bundle.nocsf.js?browserId=other&minifierType=js&languageId=en_US&b=7010&t=1522922183652:181)
    at t (bundle.nocsf.js?browserId=other&minifierType=js&languageId=en_US&b=7010&t=1522922183652:1)
    at Object.<anonymous> (bundle.nocsf.js?browserId=other&minifierType=js&languageId=en_US&b=7010&t=1522922183652:41)
    at t (bundle.nocsf.js?browserId=other&minifierType=js&languageId=en_US&b=7010&t=1522922183652:1)
    at Object.<anonymous> (bundle.nocsf.js?browserId=other&minifierType=js&languageId=en_US&b=7010&t=1522922183652:180)
    at t (bundle.nocsf.js?browserId=other&minifierType=js&languageId=en_US&b=7010&t=1522922183652:1)
    at Object.<anonymous> (bundle.nocsf.js?browserId=other&minifierType=js&languageId=en_US&b=7010&t=1522922183652:180)

Package.json file:

{
    "csfConfig": {
        "js": {
            "lint": {
                "rules": {
                    "no-unknown-property": 0
                }
            }
        },
        "path:**/{js/src/**/*,webpack.config.js}": {
            "js": {
                "lint": {
                    "parserOptions": {
                        "ecmaVersion": 7
                    }
                }
            }
        }
    },
    "dependencies": {
        "cropperjs": "^1.2.2",
        "google-map-react": "0.34.0",
        "immutable": "^3.8.2",
        "lodash": "4.17.4",
        "marble-alert": "^2.1.0",
        "metal": "^2.16.5",
        "metal-css-transitions": "^2.3.5",
        "metal-react": "^3.0.0",
        "metal-redux": "^2.0.1",
        "metal-router": "^3.6.3",
        "moment": "^2.21.0",
        "node-js-marker-clusterer": "^1.0.0",
        "react": "^16.2.0",
        "react-addons-shallow-compare": "^15.6.2",
        "react-bootstrap-table-next": "^0.1.2",
        "react-dates": "^12.7.1",
        "react-dom": "^16.2.0",
        "react-dropzone": "^4.2.5",
        "react-quill": "^1.2.6",
        "react-select": "^1.2.1",
        "react-switch": "^2.3.0",
        "react-tooltip": "^3.4.0",
        "redux": "^3.7.2",
        "redux-immutable": "^4.0.0",
        "redux-thunk": "^2.2.0",
        "scroll-into-view": "^1.9.1",
        "senna": "^2.5.0",
        "string-sub": "^0.0.1",
        "vis": "^4.21.0"
    },
    "devDependencies": {
        "babel-cli": "^6.26.0",
        "babel-core": "^6.26.0",
        "babel-loader": "^7.0.0",
        "babel-plugin-lodash": "^3.2.11",
        "babel-polyfill": "^6.26.0",
        "babel-preset-env": "^1.6.1",
        "babel-preset-metal-jsx": "^0.1.1",
        "babel-preset-stage-2": "^6.24.1",
        "check-source-formatting": "^2.0.5",
        "cross-env": "^5.1.3",
        "webpack": "^3.10.0"
    },
    "main": "src/main/resources/META-INF/resources/js/src/main.js",
    "scripts": {
        "webpack": "cross-env NODE_ENV=production webpack --progress",
        "webpack:dev": "cross-env NODE_ENV=developement webpack --progress",
        "webpack:watch": "cross-env NODE_ENV=development webpack --watch"
    },
    "version": "1.0.0"
}
ssmith353 commented 6 years ago

https://www.bountysource.com/issues/47630631-multiple-declarations-of-goog-string-with-webpack-and-soy Fixed it.

jbalsas commented 6 years ago

Nice catch, @ssmith353!

We actually attempted to fix that lately in https://github.com/metal/metal.js/pull/365/commits/58dec820f9fba6b4b810f622be2c28d3fdbec442, so I'd venture that you are not getting the latest 2.16.5 versions of those packages. Otherwise I would expect this to work even if webpack was failing to dedupe them...

ssmith353 commented 6 years ago

hey @jbalsas, I updated to latest 2.16.5, but thats actually when it broke. Even after clearing cache, updating npm, and clearing/reinstalling many times. The issue persisted. But it looks like the guide you posted to resolved the issue!

Thanks!

jbalsas commented 6 years ago

Could you send me a link to the code via mail so I can take a look? THanks!