Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

webpack locale err #4126

Closed
willin opened this issue Aug 17, 2017 · 5 comments
Closed

webpack locale err #4126

willin opened this issue Aug 17, 2017 · 5 comments

Comments

@willin
Copy link

willin commented Aug 17, 2017

Description of the Issue and Steps to Reproduce:

webpack config add:

  resolve: {
    alias: {
      vue$: 'vue/dist/vue.esm.js',
      moment: 'moment/src/moment'
    }
  }
<script>
import moment from 'moment'
moment.locale('zh-cn'); // pack error
</script>

Please include the values of all variables used.

Environment:

OSX Node.js 8.4.0

Both the browser and the OS are important to us, particularly if you have an unsual environment like an IOT application.

Other information that may be helpful:

  • The time zone setting of the machine the code is running on
  • The time and date at which the code was run
  • Other libraries in use (TypeScript, Immutable.js, etc)

If you are reporting an issue, please run the following code in the environment you are using and include the output:

console.log( (new Date()).toString())
console.log((new Date()).toLocaleString())
console.log( (new Date()).getTimezoneOffset())
console.log( navigator.userAgent)
console.log(moment.version)
console.log( (new Date()).toString())
Thu Aug 17 2017 17:09:27 GMT+0800 (CST)
console.log((new Date()).toLocaleString())
2017-8-17 17:09:27
console.log( (new Date()).getTimezoneOffset())
-480
console.log( navigator.userAgent)
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3178.0 Safari/537.36
console.log(moment.version)
2.18.1

Ensure your issue is isolated to moment. Issues involving third party tools will be closed unless submitted by the tool's author/maintainer.

WARNING in ./node_modules/moment/src/lib/locale/locales.js
Module not found: Error: Can't resolve './locale' in '/Users/willin/Documents/w2fs/coding-task/node_modules/moment/src/lib/locale'
 @ ./node_modules/moment/src/lib/locale/locales.js 55:12-39
 @ ./node_modules/moment/src/lib/locale/locale.js
 @ ./node_modules/moment/src/moment.js
 @ ./src/component/moment/index.js
 @ ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./src/router/timeline/tasks.vue
 @ ./src/router/timeline/tasks.vue
 @ ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./src/router/timeline/timeline.vue
 @ ./src/router/timeline/timeline.vue
 @ ./src/router/timeline/index.js
 @ ./src/router/index.js
 @ ./src/main.js
 @ multi (webpack)-dev-server/client?http://localhost:3993 webpack/hot/dev-server ./src/main.js
@ovangle
Copy link
Contributor

ovangle commented Aug 17, 2017

This was fixed in #4042 and should be fine in the next release. In the meantime the easiest reliable workaround for the the issue is to manaully change require('./locale/' + name) to require('moment/locale/' + name) in your node_modules/moment directory.

@bradywatkinson
Copy link

Hey just noticed on the change log page that this fix has not been included in a release yet, just wondering when the cuttable release is

@amihailes
Copy link

webpack 3.6.0 + moment 2.19.0 still has the problem.

Seems like the proble is not fixed in latest release.....

@Alexintosh
Copy link

Looks like the issue it's still there

@mahansky
Copy link

Same problem here.
I have a project that's working on 4 computers. Another computer I am trying to set it up on throws the same error as described.
Webpack (2.2.1) and Moment (2.15.1) versions are the same everywhere. Node/Npm similar/same.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants