diff --git a/Cargo.toml b/Cargo.toml index 7810b7ea..305b9671 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -66,7 +66,7 @@ members = [ "examples/fetch", "examples/guide-supported-types-examples", "examples/hello_world", - "examples/import_js", + "examples/import_js/crate", "examples/julia_set", "examples/paint", "examples/performance", diff --git a/examples/import_js/Cargo.toml b/examples/import_js/crate/Cargo.toml similarity index 100% rename from examples/import_js/Cargo.toml rename to examples/import_js/crate/Cargo.toml diff --git a/examples/import_js/defined-in-js.js b/examples/import_js/crate/defined-in-js.js similarity index 100% rename from examples/import_js/defined-in-js.js rename to examples/import_js/crate/defined-in-js.js diff --git a/examples/import_js/src/lib.rs b/examples/import_js/crate/src/lib.rs similarity index 100% rename from examples/import_js/src/lib.rs rename to examples/import_js/crate/src/lib.rs diff --git a/examples/import_js/index.js b/examples/import_js/index.js index 0c41f50d..e3955b09 100644 --- a/examples/import_js/index.js +++ b/examples/import_js/index.js @@ -1,4 +1,4 @@ // For more comments about what's going on here, check out the `hello_world` // example -import('./pkg/import_js') +import('./crate/pkg/import_js') .catch(console.error); diff --git a/examples/import_js/webpack.config.js b/examples/import_js/webpack.config.js index 25afd180..60fdbe37 100644 --- a/examples/import_js/webpack.config.js +++ b/examples/import_js/webpack.config.js @@ -14,7 +14,7 @@ module.exports = { template: 'index.html' }), new WasmPackPlugin({ - crateDirectory: path.resolve(__dirname, ".") + crateDirectory: path.resolve(__dirname, "crate") }), // Have this example work in Edge which doesn't ship `TextEncoder` or // `TextDecoder` at this time. diff --git a/guide/src/examples/import-js.md b/guide/src/examples/import-js.md index 879657dc..e572aa63 100644 --- a/guide/src/examples/import-js.md +++ b/guide/src/examples/import-js.md @@ -13,13 +13,13 @@ For example if you're working with this JS file: ```js // defined-in-js.js -{{#include ../../../examples/import_js/defined-in-js.js}} +{{#include ../../../examples/import_js/crate/defined-in-js.js}} ``` you can use it in Rust with: ```rust -{{#include ../../../examples/import_js/src/lib.rs}} +{{#include ../../../examples/import_js/crate/src/lib.rs}} ``` You can also [explore the full list of ways to configure imports][attr]