kunashir
kunashir

Reputation: 949

Migrate to webpack 2, Module not found: Error: Can't resolve 'exports'

I am trying to migrate my current project (on Angular2) to webpack2. This my config for webpack:

https://gist.github.com/kunashir/5174a237d7404079ebd8f343deee0037

But I have got an error:

ERROR in ./app/common/forms/ckeditor.component.ts
Module not found: Error: Can't resolve 'exports' in 
'/home/al1/projects/voltmobi/ytaxiweb/ui/app/common/forms'
BREAKING CHANGE: It's no longer allowed to omit the '-loader' suffix when using loaders.
             You need to specify 'exports-loader' instead of 'exports',
             see https://webpack.js.org/guides/migrating/#automatic-loader-module-name-extension-removed

However I don't use exports-loader and it not in config for webpack1.

String from module which bring the error:

 import { Constants } from 'config/constants'

Module for import looks like:

export class Constants {
  static API = {
    PATH: '/web_api'
  }
}

I'm newbie with Webpack.

Maybe I was wrong and problem in:

let loadCKEDITOR = require('bundle-loader?lazy!exports?window.CKEDITOR!ckeditor/ckeditor')

Upvotes: 1

Views: 694

Answers (1)

Michael Jungo
Michael Jungo

Reputation: 32972

You are not using exports-loader in your config, but you specify it inline:

let loadCKEDITOR = require('bundle-loader?lazy!exports?window.CKEDITOR!ckeditor/ckeditor')
                                               ^^^^^^^

As the error suggests, this should be exports-loader.

let loadCKEDITOR = require('bundle-loader?lazy!exports-loader?window.CKEDITOR!ckeditor/ckeditor')

Upvotes: 2

Related Questions