迁移到webpack 2,未找到模块:错误:无法解析'exports'
问题描述:
我正试图将我当前的项目(在Angular2上)迁移到webpack2。 这是我对的WebPack配置:迁移到webpack 2,未找到模块:错误:无法解析'exports'
https://gist.github.com/kunashir/5174a237d7404079ebd8f343deee0037
但我得到了一个错误:
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
但是我不使用出口装载机,它没有配置为webpack1。从模块
字符串,它带来的错误:
import { Constants } from 'config/constants'
模块进口的样子:
export class Constants {
static API = {
PATH: '/web_api'
}
}
我新手与的WebPack。
也许我是错的,在问题:
let loadCKEDITOR = require('bundle-loader?lazy!exports?window.CKEDITOR!ckeditor/ckeditor')
答
你是不是在你的配置使用exports-loader
,但你指定它inline:
let loadCKEDITOR = require('bundle-loader?lazy!exports?window.CKEDITOR!ckeditor/ckeditor')
^^^^^^^
由于错误提示,这应该是exports-loader
。
let loadCKEDITOR = require('bundle-loader?lazy!exports-loader?window.CKEDITOR!ckeditor/ckeditor')