LoginSignup
0
0

More than 5 years have passed since last update.

reactでModule parse failed

Posted at

Module parse failed: fontawesome-webfont.ttf?v=4.7.0 Unexpected character '

ハンドルされない例外 下記ソースコードの行 5071、列 1 で発生しました。http://localhost:64258/dist/main.js?v=AXhhFHvUlrsCQah5ZNBxyrBDS2NJSr0TquwzVdDbIEQ
0x800a139e - JavaScript 実行時エラー: Module parse failed: C:\Temp\admin-lte-vs\admin-lte-vs\node_modules\font-awesome\fonts\fontawesome-webfont.ttf?v=4.7.0 Unexpected character '

image

module > rules に拡張子を追加

{ test: /\.(png|jpg|jpeg|gif|svg|eot|woff2|woff|ttf)$/, use: 'url-loader?limit=25000' }

module.exports = (env) => {
    const isDevBuild = !(env && env.prod);
    return [{
        stats: { modules: false },
        entry: { 'main': './ClientApp/boot.tsx' },
        resolve: { extensions: ['.js', '.jsx', '.ts', '.tsx'] },
        output: {
            path: path.join(__dirname, bundleOutputDir),
            filename: '[name].js',
            publicPath: 'dist/'
        },
        module: {
            rules: [
                { test: /\.tsx?$/, include: /ClientApp/, use: 'awesome-typescript-loader?silent=true' },
                { test: /\.css$/, use: isDevBuild ? ['style-loader', 'css-loader'] : ExtractTextPlugin.extract({ use: 'css-loader?minimize' }) },
                { test: /\.(png|jpg|jpeg|gif|svg|eot|woff2|woff|ttf)$/, use: 'url-loader?limit=25000' }
            ]
        },
        plugins: [
            new CheckerPlugin(),
            new webpack.DllReferencePlugin({
                context: __dirname,
                manifest: require('./wwwroot/dist/vendor-manifest.json')
            })
        ].concat(isDevBuild ? [
            // Plugins that apply in development builds only
            new webpack.SourceMapDevToolPlugin({
                filename: '[file].map', // Remove this line if you prefer inline source maps
                moduleFilenameTemplate: path.relative(bundleOutputDir, '[resourcePath]') // Point sourcemap entries to the original file locations on disk
            })
        ] : [
            // Plugins that apply in production builds only
            new webpack.optimize.UglifyJsPlugin(),
            new ExtractTextPlugin('site.css')
        ])
    }];
};
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0