WebPack を使用して「対決」を含めようとしています。問題は、showdown が require("fs") を実行し、戻り値を確認することです。これにより、WebPack がエラーをスローします。
require("fs") の呼び出しが false を返すように、シムを生成するように Webpack を構成することが可能であるように思われます。
おそらく、これらの手法のいずれかが機能する可能性があります: http://webpack.github.io/docs/shimming-modules.html
これが Showdown.js コードです。node modules ディレクトリ内のこのコードをコメントアウトすると、問題は解決します。ただし、もっと良い方法があるはずです。
//
// Automatic Extension Loading (node only):
//
if (typeof module !== 'undefind' && typeof exports !== 'undefined' && typeof require !== 'undefind') {
var fs = require('fs');
if (fs) {
// Search extensions folder
var extensions = fs.readdirSync((__dirname || '.')+'/extensions').filter(function(file){
return ~file.indexOf('.js');
}).map(function(file){
return file.replace(/\.js$/, '');
});
// Load extensions into Showdown namespace
Showdown.forEach(extensions, function(ext){
var name = stdExtName(ext);
Showdown.extensions[name] = require('./extensions/' + ext);
});
}
}