0

In my webpack.conf.js I set babel-loader like this

  {
    test: /\.js$/,
    loader: 'babel-loader',
    include: [resolve('src'), resolve('test'),resolve('node_modules/moment')],
    options: {
      presets: [['es2015', { modules: false }]],
      plugins: ['syntax-dynamic-import']
    }
  },

And I would like to just import moment from 'moment', but webpack issues the warning,

export 'default' (imported as 'moment') was not found in 'moment'

I tried the suggestion here, How can I import momentjs in es6? e.g. using import moment from 'moment/src/moment' then I got another warning

This relative module was not found:

  • ./locale in ./node_modules/moment/src/lib/locale/locales.js

I have used uglifyjs-webpack-plugin 1.1 to minify my codes and IE11 can access them, which makes me believe there should be a simple way to make babel-loader transpile my code to es5 and let IE access them.

Qiulang
  • 10,295
  • 11
  • 80
  • 129

0 Answers0