Code Monkey home page Code Monkey logo

Comments (7)

alexander-akait avatar alexander-akait commented on May 27, 2024 1

I see the problem, right now you can use:

"scripts": {
    "build": "WEBPACK_CLI_FORCE_LOAD_ESM_CONFIG=1 NODE_ENV=production NODE_OPTIONS='--import tsimp/import' webpack --disable-interpret"
},

Anyway you still have some problems with ts/babel configuration.

Using --disable-interpret you will disable built-in behaviour and using WEBPACK_CLI_FORCE_LOAD_ESM_CONFIG you are saying to load configuration as ESM.

Feel free to feedback

from webpack-cli.

wojtekmaj avatar wojtekmaj commented on May 27, 2024 1

This worked for me! Thanks!

from webpack-cli.

alexander-akait avatar alexander-akait commented on May 27, 2024

NODE_ENV=production NODE_OPTIONS='--loader=tsimp/loader' webpack works fine for me locally without any problem, expect experimental message, check your enviroment, looks like you don't have installed tsimp

Here docs - https://github.com/tapjs/tsimp?tab=readme-ov-file#usage, supported ESM --import is still under experiments

Close due #3905

Feel free to feedback

from webpack-cli.

wojtekmaj avatar wojtekmaj commented on May 27, 2024

@alexander-akait Unfortunately, this does not work. --loader or --import, doesn't make a diffetence. I double checked, I do have tsimp installed correctly. Still getting:

[webpack-cli] Unable load '/app/webpack.config.ts'
[webpack-cli] Unable to use specified module loaders for ".ts".
[webpack-cli] Cannot find module 'ts-node/register' from '/app'
[webpack-cli] Cannot find module 'sucrase/register/ts' from '/app'
[webpack-cli] Cannot find module '@babel/register' from '/app'
[webpack-cli] Cannot find module 'esbuild-register/dist/node' from '/app'
[webpack-cli] Cannot find module '@swc/register' from '/app'
[webpack-cli] Please install one of them

I have also tried adding --disable-interpret, hoping that maybe it could resolve the issue for me, but to no avail.

from webpack-cli.

alexander-akait avatar alexander-akait commented on May 27, 2024

@wojtekmaj strange, maybe you can create a reproducible repo? Because it works locally for me, also please check your version

from webpack-cli.

wojtekmaj avatar wojtekmaj commented on May 27, 2024

There is absolutely nothing unusual about my setup. Here's my minimal repro repo:

web.zip

However, I believe the key is that you may have one of the listed packages ('ts-node/register', 'sucrase/register/ts', '@babel/register', 'esbuild-register/dist/node', '@swc/register') installed alongside tsimp, causing the error not to appear.

from webpack-cli.

alexander-akait avatar alexander-akait commented on May 27, 2024

Anyway in future we will improve it and you will need less extra code to run it, we are waiting interpret developers, also we need support --import syntax on the interpret side (right now only register wroks)

from webpack-cli.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.