Closed jongwon-park closed 5 years ago
Hi @jongwon-park,
Thanks for your message. Weird, I'm not able to replicate this error on my end. Could you give me a little more info about your environment and the context in which you're using this method when you get the error?
-Garrett
My environment is angular v6.1.6 webpack v4.9.2 node 10.14.1
this is my webpack.config.js
const path = require('path');
const webpack = require('webpack');
/**
* This is a server config which should be merged on top of common config
*/
module.exports = {
mode: 'development',
externals: [/(node_modules|main\..*\.js)/],
entry: {
// This is our Express server for Dynamic universal
server: './server.ts',
// This is an example of Static prerendering (generative)
prerender: './prerender.ts',
},
resolve: { extensions: ['.js', '.ts'] },
output: {
// Puts the output at the root of the dist folder
path: path.join(__dirname, 'dist'),
filename: '[name].js'
},
plugins: [
new webpack.ContextReplacementPlugin(
// fixes WARNING Critical dependency: the request of a dependency is an expression
/(.+)?angular(\\|\/)core(.+)?/,
path.join(__dirname, 'src'), // location of your src
{} // a map of your routes
),
new webpack.ContextReplacementPlugin(
// fixes WARNING Critical dependency: the request of a dependency is an expression
/(.+)?express(\\|\/)(.+)?/,
path.join(__dirname, 'src'),
{}
)
],
target: 'node',
node: {
__dirname: false
},
};
midi-writer-js v1.6.0 works very well in my environment.
I get the error when I run the ng serve
command using v1.7.0 midi-writer-js only.
Hi @jongwon-park,
I think this might be related to webpack. Check this comment for possible resolution: https://github.com/webpack-contrib/css-loader/issues/447#issuecomment-285598881
-Garrett
An error occurs in v1.7.0 as shown below.
ERROR in ./node_modules/midi-writer-js/build/index.js Module not found: Error: Can't resolve 'fs' in '......./node_modules/midi-writer-js/build'
Perhaps,
const fs = require('fs');
of saveMIDI function in Writer class is the problem.