gab*_*ese 14 javascript ace-editor webpack
我目前正在尝试使用webpack来要求ace-builds(从凉亭安装).由于它是一个巨大的lib,我将整个文件夹添加到noParse选项.我在终端上使用-d选项运行webpack.
问题是:当我的代码试图要求它时,它是一个空对象.此外,它没有被浏览器加载.以下是我正在做的一些信息:
我的档案:
// custom_editor.js
// ace-builds are aliased by ace keyword
var Ace = require('ace/ace'); // This is an empty Object when I'm debugging with breakpoints
Run Code Online (Sandbox Code Playgroud)

配置文件:
// webpack.config.js
var webpack = require('webpack');
var path = require('path');
module.exports = {
entry: {
form: path.join(__dirname, 'static/main_files/form.js'),
vendor: [
'jquery',
'react',
'underscore',
'query-string',
'react-dnd',
'react-select-box'
]
},
output: {
path: path.join(__dirname, 'static/bundle'),
filename: '[name].bundle.js'
},
module: {
loaders: [{
test: /\.jsx$/,
loader: 'jsx-loader?insertPragma=React.DOM'
}],
noParse: [
/ace-builds.*/
]
},
resolve: {
extensions: ['', '.js', '.jsx'],
root: [
__dirname,
path.join(__dirname, 'static'),
path.join(__dirname, 'node_modules')
],
alias: {
jQueryMask: 'node_modules/jquery-mask-plugin/dist/jquery.mask',
twbsDropdown: 'node_modules/bootstrap-sass/assets/javascripts/bootstrap/dropdown',
'twbs-datetimepicker': 'node_modules/eonasdan-bootstrap-datetimepicker/src/js/bootstrap-datetimepicker',
ace: 'bower_components/ace-builds/src',
'select-box': 'node_modules/react-select-box/lib/select-box',
queryString: 'node_modules/query-string/query-string',
moment: 'node_modules/moment/moment'
}
},
plugins: [
new webpack.ResolverPlugin(
new webpack.ResolverPlugin.DirectoryDescriptionFilePlugin("bower.json", ["main"])
),
new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery'
})
]
};
Run Code Online (Sandbox Code Playgroud)
它未加载到Chrome的网络面板上

它显示在Chrome的Sources面板上(不知道为什么因为没有加载ace.map文件)

真的没有我在这里做错的想法.有没有可以克隆和测试的好例子?(它也可以是另一个lib).
U A*_*los 23
使用brace.它是aceify编辑器的浏览器兼容版本,也适用于webpack.版本0.5.1使用ace 1.1.9.
https://github.com/thlorenz/brace
| 归档时间: |
|
| 查看次数: |
6122 次 |
| 最近记录: |