Skip to content

Commit 3aa26e6

Browse files
committed
Fix convert
1 parent a65a5a5 commit 3aa26e6

File tree

5 files changed

+13
-8
lines changed

5 files changed

+13
-8
lines changed

.changeset/tame-doors-rest.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@devup-ui/webpack-plugin": patch
3+
"@devup-ui/wasm": patch
4+
---
5+
6+
Fix convert issue

bindings/devup-ui-wasm/src/lib.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ pub struct Output {
2020
extern "C" {
2121
#[wasm_bindgen(js_namespace = console)]
2222
fn log(s: &JsValue);
23+
#[wasm_bindgen(js_namespace = console, js_name = log)]
24+
fn log_str(s: &str);
2325
}
2426

2527
#[wasm_bindgen]
@@ -100,11 +102,7 @@ pub fn code_extract(
100102
},
101103
) {
102104
Ok(output) => Ok(Output {
103-
code: if output.styles.is_empty() {
104-
code.to_string()
105-
} else {
106-
output.code
107-
},
105+
code: output.code,
108106
styles: output.styles,
109107
}),
110108
Err(error) => Err(JsValue::from_str(error.to_string().as_str())),

packages/webpack-plugin/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525
"./css-loader": {
2626
"import": "./dist/css-loader.js",
2727
"require": "./dist/css-loader.cjs"
28-
}
28+
},
29+
"./dist/*": "./dist/*"
2930
},
3031
"files": [
3132
"dist"

packages/webpack-plugin/src/loader.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const devupUILoader: RawLoaderDefinitionFunction<DevupUILoaderOptions> =
2727

2828
try {
2929
const { code, css } = codeExtract(
30-
this.resourcePath,
30+
id,
3131
source.toString(),
3232
libPackage,
3333
cssFile,

packages/webpack-plugin/src/plugin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export class DevupUIWebpackPlugin {
3030
cssFile = join(_dirname, 'devup-ui.css'),
3131
devupPath = 'devup.json',
3232
interfacePath = '.df',
33-
}: Partial<DevupUIWebpackPluginOptions>) {
33+
}: Partial<DevupUIWebpackPluginOptions> = {}) {
3434
this.options = {
3535
package: libPackage,
3636
cssFile,

0 commit comments

Comments
 (0)