Cimpress-MCP / postal-codes-js

Provide postal code validation for javascript
Apache License 2.0
43 stars 36 forks source link

error in webpack and babel #21

Open gasner opened 6 years ago

gasner commented 6 years ago

I get this error:

ERROR in ./node_modules/postal-codes-js/formats/US.json Module parse failed: Unexpected token  in JSON at position 0 You may need an appropriate loader to handle this file type. SyntaxError: Unexpected token  in JSON at position 0

this is my module:

module: {
        rules: [
            {test: /\.js$/, exclude: /node_modules/, loader: "babel-loader"},
            {test: /\.vue$/, loader: "vue-loader"},
            {test: /\.css$/, use: [{loader: "style-loader"}, {loader: "css-loader"}]},
            {test: /\.html$/, loader: "html-loader"},
            {test: /\.jpg$/, loader: "file-loader"},
            {test: /\.png$/, loader: "url-loader?mimetype=image/png"},
            {test: /\.(woff|woff2)$/, loader: "url-loader?limit=10000&mimetype=application/font-woff"},
            {test: /\.ttf$/, loader: "file-loader"},
            {test: /\.eot$/, loader: "file-loader"},
            {test: /\.svg$/, loader: "file-loader"},
        ]
    },
 "babel-core": "^6.26.0",
"babel-loader": "^7.1.4",
"babel-polyfill": "^6.26.0",
"babel-preset-env": "^1.6.1",

"webpack": "^4.2.0",

lpuccini commented 6 years ago

We also have problems with webpack and babel, we cannot compile. With similar settings

 "@babel/core": "7.0.0-beta.46",
    "@babel/plugin-proposal-class-properties": "7.0.0-beta.46",
    "@babel/plugin-proposal-object-rest-spread": "7.0.0-beta.46",
    "@babel/plugin-syntax-dynamic-import": "7.0.0-beta.46",
    "@babel/plugin-transform-classes": "7.0.0-beta.46",
    "@babel/plugin-transform-destructuring": "7.0.0-beta.46",
    "@babel/plugin-transform-react-constant-elements": "7.0.0-beta.46",
    "@babel/plugin-transform-react-display-name": "7.0.0-beta.46",
    "@babel/plugin-transform-regenerator": "7.0.0-beta.46",
    "@babel/plugin-transform-runtime": "7.0.0-beta.46",
    "@babel/preset-env": "7.0.0-beta.46",
    "@babel/preset-flow": "7.0.0-beta.46",
    "@babel/preset-react": "7.0.0-beta.46",
    "babel-plugin-macros": "2.2.1",
    "babel-plugin-transform-dynamic-import": "2.0.0",
    "babel-plugin-transform-react-remove-prop-types": "0.4.13"

when building we got:

Creating an optimized production build...
Failed to compile.

Failed to minify the code from this file: 

     ./node_modules/postal-codes-js/postal-codes.js:7 

Read more here: http://bit.ly/2tRViJ9

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! postcode-validator-frontend@0.1.0 build: `rm -rf build && react-scripts build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the postcode-validator-frontend@0.1.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2018-09-10T12_21_46_979Z-debug.log
The command '/bin/sh -c npm run build' returned a non-zero code: 1
Exited with code 1
joeyfigaro commented 5 years ago

Same issues. Lib is unusable if you're using a copy of react-scripts that is pre 2.0

alessandrocentanni commented 5 years ago

Still having same issue, is this going to be fixed anytime soon?

ozankaya commented 5 years ago

Can you please list the steps for reproducing this issue?