Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const PnpWebpackPlugin = require('pnp-webpack-plugin');
module.exports = {
test: /\.tsx?(\.erb)?$/,
use: [
{
loader: 'ts-loader',
options: PnpWebpackPlugin.tsLoaderOptions({
appendTsSuffixTo: [/\.vue$/],
// Using `fork-ts-checker-webpack-plugin` See:
// https://github.com/TypeStrong/fork-ts-checker-webpack-plugin
// to run type checking in a separate process, so `ts-loader` only does the
// compilation work. Reduces compile time like crazy. See also:
// https://github.com/TypeStrong/ts-loader#faster-builds
transpileOnly: true
})
}
]
};
new ForkTsCheckerWebpackPlugin(PnpWebpackPlugin.forkTsCheckerOptions({
tslint: true,
useTypescriptIncrementalApi: false, // not possible to use this until: https://github.com/microsoft/TypeScript/issues/31056
})),
new ForkTsCheckerNotifierWebpackPlugin({ title: 'TypeScript', excludeWarnings: false }),
new HtmlWebpackPlugin({
inject: true,
template: 'src/index.html'
}),
],
module: {
rules: [
{
test: /.tsx?$/,
loader: require.resolve("ts-loader"),
options: PnpWebpackPlugin.tsLoaderOptions({ transpileOnly: true })
}
]
},
resolve: {
extensions: [".ts", ".tsx", ".js"],
plugins: [PnpWebpackPlugin]
},
resolveLoader: {
plugins: [PnpWebpackPlugin.moduleLoader(module)]
},
devtool: 'inline-source-map',
devServer: {
clientLogLevel: 'warning',
open: true,
historyApiFallback: true,
stats: 'errors-only'
// "url" loader works like "file" loader except that it embeds assets
// smaller than specified limit in bytes as data URLs to avoid requests.
// A missing `test` is equivalent to a match.
{
test: [/\.bmp$/, /\.gif$/, /\.jpe?g$/, /\.png$/],
loader: require.resolve('url-loader'),
options: {
limit: 10000,
name: 'static/media/[name].[hash:8].[ext]',
},
},
{
test: /\.tsx?$/,
include: paths.appSrc,
loader: require.resolve('ts-loader'),
options: PnpWebpackPlugin.tsLoaderOptions({
transpileOnly: isEnvDevelopment,
configFile: path.resolve(__dirname, '../tsconfig.build.json'),
}),
},
// Process application JS with Babel.
// The preset includes JSX, Flow, and some ESnext features.
{
test: /\.(js|jsx)$/,
include: paths.appSrc,
loader: require.resolve('babel-loader'),
options: {
customize: require.resolve('babel-preset-react-app/webpack-overrides'),
plugins: [
[
require.resolve('babel-plugin-named-asset-import'),
const PnpWebpackPlugin = require('pnp-webpack-plugin');
module.exports = {
test: /\.tsx?(\.erb)?$/,
use: [
{
loader: 'ts-loader',
options: PnpWebpackPlugin.tsLoaderOptions()
}
]
};
const PnpWebpackPlugin = require('pnp-webpack-plugin')
module.exports = {
test: /\.tsx?(\.erb)?$/,
use: [
{
loader: 'ts-loader',
options: PnpWebpackPlugin.tsLoaderOptions()
}
]
}
const PnpWebpackPlugin = require('pnp-webpack-plugin')
module.exports = {
test: /\.tsx?(\.erb)?$/,
use: [
{
loader: 'ts-loader',
options: PnpWebpackPlugin.tsLoaderOptions()
}
]
}
const { environment } = require('@rails/webpacker')
const { VueLoaderPlugin } = require('vue-loader')
const vue = require('./loaders/vue')
const path = require('path');
environment.config.resolve.alias = {
'jquery': 'backbone.native',
'@blitz': path.resolve(__dirname, '../../app/javascript'),
}
environment.loaders.append('typescript', {
test: /\.tsx?(\.erb)?$/,
use: [
{
loader: 'ts-loader',
options: PnpWebpackPlugin.tsLoaderOptions({
appendTsSuffixTo: [/\.vue$/]
}),
}
]
})
environment.loaders.append('pug', {
test: /\.pug$/,
loader: 'pug-plain-loader'
})
environment.loaders.append('chess.js', {
test: /chess\.js/,
parser: {
amd: false,
}
useShortDoctype: true,
removeEmptyAttributes: true,
removeStyleLinkTypeAttributes: true,
keepClosingSlash: true,
minifyJS: true,
minifyCSS: true,
minifyURLs: true,
},
}),
],
module: {
rules: [
{
test: /.tsx?$/,
loader: require.resolve("ts-loader"),
options: PnpWebpackPlugin.tsLoaderOptions({ transpileOnly: true })
}
]
},
resolve: {
extensions: [".ts", ".tsx", ".js"],
plugins: [PnpWebpackPlugin]
},
resolveLoader: {
plugins: [PnpWebpackPlugin.moduleLoader(module)]
}
};
const PnpWebpackPlugin = require('pnp-webpack-plugin')
module.exports = {
test: /\.(ts|tsx)?(\.erb)?$/,
use: [
{
loader: 'ts-loader',
options: PnpWebpackPlugin.tsLoaderOptions()
}
]
}