Skip to content

Commit

Permalink
Fix use of expose-loader in playground
Browse files Browse the repository at this point in the history
This fixes two problems:
- module rules were not being correctly passed to webpack
- now that `resolve: { symlinks: false }` has been added to the webpack
  config, webpack and Node disagree on the path to a module accessed
  through `npm link`. This means that passing `require.resolve`'s result
  to webpack is no longer guaranteed to work for a module `test`.
  Instead we now use `path.resolve` which will match webpack's idea of
  the path.
  • Loading branch information
Christopher Willis-Ford committed Mar 24, 2017
1 parent 2f3157b commit 4f095b7
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ module.exports = [
filename: '[name].js'
},
module: {
rules: [
rules: base.module.rules.concat([
{
test: require.resolve('./src/index.js'),
loader: 'expose-loader?VirtualMachine'
}
]
])
}
}),
// Playground
Expand Down Expand Up @@ -84,7 +84,7 @@ module.exports = [
filename: '[name].js'
},
module: {
loaders: [
rules: base.module.rules.concat([
{
test: require.resolve('./src/index.js'),
loader: 'expose-loader?VirtualMachine'
Expand All @@ -102,18 +102,18 @@ module.exports = [
loader: 'expose-loader?Blockly'
},
{
test: require.resolve('scratch-audio'),
test: path.resolve(__dirname, 'node_modules', 'scratch-audio', 'src', 'index.js'),
loader: 'expose-loader?AudioEngine'
},
{
test: require.resolve('scratch-render'),
test: path.resolve(__dirname, 'node_modules', 'scratch-render', 'src', 'index.js'),
loader: 'expose-loader?RenderWebGL'
},
{
test: require.resolve('scratch-storage'),
test: path.resolve(__dirname, 'node_modules', 'scratch-storage', 'src', 'index.js'),
loader: 'expose-loader?Scratch.Storage'
}
]
])
},
plugins: base.plugins.concat([
new CopyWebpackPlugin([{
Expand Down

0 comments on commit 4f095b7

Please sign in to comment.