Closed linkarys closed 7 years ago
如题,loadBabelModule的实现在某些情况下会出现以下错误(出错环境: mac, node v8.0.0, npm v5.0.3),
const defaultLoaders = { none: '', main: path.resolve(loaderPath, 'loader.js'), extract: path.resolve(loaderPath, 'extract.js'), template: path.resolve(loaderPath, 'template.js'), style: path.resolve(loaderPath, 'style.js'), script: path.resolve(loaderPath, 'script.js'), json: path.resolve(loaderPath, 'json.js'), babel: loadBabelModule('babel-loader') } function loadBabelModule (moduleName) { try { const filePath = require.resolve(moduleName) return filePath.slice(0, filePath.lastIndexOf(moduleName) + moduleName.length) } catch (e) { return moduleName } } ... loaders.push({ name: defaultLoaders.babel, query: { presets: [loadBabelModule('babel-preset-es2015')], plugins: [loadBabelModule('babel-plugin-transform-runtime')], comments: 'false' } })
此处为什么特意写了一个loadBabelModule, 而不直接使用字符串? @exolution @terrykingcha
loadBabelModule
refer: https://github.com/weexteam/weex-loader/commit/76cf603b5102af74a8a934458b831829628cdbae
Fixed in #51 .
如题,loadBabelModule的实现在某些情况下会出现以下错误(出错环境: mac, node v8.0.0, npm v5.0.3),
此处为什么特意写了一个
loadBabelModule
, 而不直接使用字符串? @exolution @terrykingcharefer: https://github.com/weexteam/weex-loader/commit/76cf603b5102af74a8a934458b831829628cdbae